Is it possible to run robot tests using a Data.fs from production instead of creating it on the fly?

I'm trying to test a bunch of upgradeSteps in a portal and would like to run some robot tests instead of manual testing: the plone.app.testing infrastructure always create a Data.fs on the fly, is it possible to use an already populated Data.fs from production?

You can do this when you define your own layer for your tests, instead of the default Plone layer.
Override the createDatabase method in your layer to load an existing Data.fs: https://github.com/plone/plone.testing/blob/master/src/plone/testing/zodb.py#L76

The tests should not be effecting the Data.fs on disk, as we wrap the storage in a DemoStorage for you via https://github.com/plone/plone.app.testing/blob/master/plone/app/testing/layers.py#L95

1 Like

Thanks for the provided solution! Would you mind explaining

The tests should not be effecting the Data.fs on disk, as we wrap the storage in a DemoStorage via https://github.com/plone/plone.app.testing/blob/master/plone/app/testing/layers.py#L952

A little more? What exactly should I override in createStorage?

Just override createDatabase to return a FileStorage thingy for your Data.fs.

I just pointed to the plone.app.testing file to show that it's wrapped in a DemoStorage via stackDemoStorage.