springtestdbunit / spring-test-dbunit

Integration between the Spring testing framework and DBUnit
http://springtestdbunit.github.com/spring-test-dbunit/
Apache License 2.0
476 stars 238 forks source link

Set default assertion mode at class level #84

Closed sgrimm-sg closed 8 years ago

sgrimm-sg commented 9 years ago

Feature request: It'd be handy to be able to put an annotation on a test class that would change the default assertion mode for any @ExpectedDatabase annotations on methods. We usually use NON_STRICT_UNORDERED mode and it's a little ugly-looking to have to specify that explicitly on every test method.

To be more concrete, I'm asking for something along the lines of,

@DbUnitConfiguration(defaultAssertionMode = DatabaseAssertionMode.NON_STRICT_UNORDERED)
public class MyDbUnitTest {
    @Test
    @ExpectedDatabase("MyDataSet.xml")
    public void testSomeDbStuff() { ... }
}

which would be equivalent to what we do today,

public class MyDbUnitTest {
    @Test
    @ExpectedDatabase(value = "MyDataSet.xml", assertionMode = DatabaseAssertionMode.NON_STRICT_UNORDERED)
    public void testSomeDbStuff() { ... }
}
philwebb commented 8 years ago

It's a nice idea but I can't see an easy way to implement it without breaking back compatibility. If you come up with any ideas feel free to submit a pull-request.