Optimize bug-find rate, Regress Less and Execute Fast
Do you have late regressions? What if your regression finds more bugs from a single run? Assert Collector does it.
Traditional Assertions exit from your scenario when it finds the first bug, but Assert Collector does not. It finds a bug and continues to find more bugs. The best use cases are the verifications of UI & JSON Objects!
Assert Collector is built on top of Hamcrest Matchers interface.
Please see the detailed example test-case for more info.
Step 1: Import AssertCollector to your workspace. Use veirfyThat
in-place of assertThat
of Hamcrest. The rest of the interface is Hamcrest.
verifyThat( "Firstname is invalid", something.getFirstname(), is( "validFirstname" ) );
Step 2: throwAnyFailures
will throw all the failures at once, if there were any. Use it whenever required.
verifyThat( "Firstname is invalid", something.getFirstname(), is( "validFirstname" ) );
verifyThat( "Lastname is invalid", something.getLastname(), is( "invalidLastname" ) );
verifyThat( "Username is invalid", something.getUsername(), is( "invalidUsername" ) );
throwAnyFailures(); // will throw two failures. Lastname is invalid & Username is invalid
Step 3: Put throwAnyFailures
in @After
hook. All remaining failures will be thrown by After hook, if there were any.
@After
public void tearDown()
{
...
...
throwAnyFailures();
}