Looking through the integration tests written for the core modules, I see many instances of the annotation @magentoDbIsolation enabled appear above test functions.

There's no mention of this anywhere in the MTF documentation, and even after looking at Magento\TestFramework\Annotation\DbIsolation I'm still not quite clear as to its purpose.

Can anyone provide some insight? Thanks.

2 Answers 2


If this annotation is specified, DB transaction will be started before test and rolled back after it. This can be helpful if no DB fixtures are used and somethings is saved to DB in the test. Note that @magentoDataFixture also wraps the test in transaction so no need to use both annotations simultaneously.
And just for sake of completeness, specifying @magentoDbIsolation disabled is only useful if the @magentoDbIsolation enabled was specified on a test class.


The annotation @magentoDbIsolation is used in integration tests to isolate DB modifications made by tests. In other words if you run your test and make some changes to db and during test excecution you request these data from db in another session:

  • with @magentoDbIsolation enabled you will get nothing, cause data are isolated in transaction.
  • with @magentoDbIsolation disabled you will get data, cause data are not isolated.
  • without any annotation integration tests are executed in non-isolated mode.

imho, to change db data it's better to use annotation @magentoDataFixture, which uses data isolation by default.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.