@ExpectedDatabase value attribute input two or more requests #64
Comments
I'm afraid I'm not following what you mean, could you rephrase? |
@philwebb I think the trouble is that "@ExpectedDatabase" annotations are used for every table. It would be nice if you could put more than one value in the value attribute with the "@DatabaseSetup" annotation. |
So you would like the Have you seen the |
@philwebb I have resolved to write @ExpectedDatabases like the following code to set the override attribute to a false @ExpectedDatabase. @ExpectedDatabases ({ Thank you @philwebb |
Hello, I think I ran into the same issue that @bluepoet encountered and worked around using override=false: I found that @ExpectedDatabase is @repeatable, but in a test that should fail it depended on the order of the annotations on the method:
The test method is actually empty, so the expectation is that the annotation with expect_ParentSpring_updated.xml fails the test, since no update happens. But if I change the order of the @ExpectedDatabase annotations, the test succeeds:
By checking the code I found that verification stops if one annotation has the override flag set to true, which is the default for @ExpectedDatabase, see In this case, the last annotation is evaluated first and, since override==true, stops further verification. I think the concept needs refinement or this behavior should be documented. Workaround is, like @bluepoet wrote, to set override=false on the annotations after the the first (or all, if no class level annotation has been done). @ExpectedDatabases annotation doesn't help since it shows the same issue. |
DBUnit works as advertised but needs an EntityManager.flush() at the end of test methods which modify data. Multiple @ExpectedDatabases annotations override each other, see springtestdbunit/spring-test-dbunit#64 (comment) Remove @DirtiesContext and other work-arounds since this is not needed anymore for the DBUnit tests. Tests run faster since Spring can re-use the test context.
I think the @ExpectedDatabase annotations added every table gon inconvenience .
@DatabaseSetup Annotations as two or more requests to enter the value attribute.
The text was updated successfully, but these errors were encountered: