Can someone explain what the @magentoDbIsolation annotation does for an integration test?

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.