JUnit 4 extension for recheck. Automatic set up and tear down of tests using recheck.
- Calls
startTest
on givenRecheckLifecycle
object before each test. - Calls
capTest
on givenRecheckLifecycle
object after each test. - Calls
cap
on givenRecheckLifecycle
object after each test.
The extension automatically calls startTest
, capTest
and cap
. So it is no longer required to call those methods manually. This reduces boilerplate code and ensures the life cycle within a test using recheck.
You can add recheck-junit-4-extension as an external dependency to your project. It is available in Maven central or via the release-page, which allows you to include it into your favorite build tool.
For the current version, please refer to the release-page.
<dependency>
<groupId>de.retest</groupId>
<artifactId>recheck-junit-4-extension</artifactId>
<version>${LATEST_VERSION_FROM_ABOVE_LINK}</version>
</dependency>
compile 'de.retest:recheck-junit-4-extension:${LATEST_VERSION_FROM_ABOVE_LINK}'
Recheck JUnit extension defines a JUnit 4 Rule. The rule needs to know the instance of the used RecheckLifecycle
element. The instance can be given during construction or afterwards during setup. The following code demonstrates both ways.
// Define RecheckLifecycle instance before Rule
private RecheckLifecycle re = new RecheckImpl();
// Let rule know which RecheckLifecycle instance should be administered
@Rule
public RecheckRule recheckRule = new RecheckRule(re);
@Rule
public RecheckRule recheckRule = new RecheckRule();
private RecheckLifecycle re;
@Before
public void before() {
re = new RecheckImpl();
// Let rule know which RecheckLifecycle instance should be administered
recheckRule.use(re);
}
Requires JUnit 4. For JUnit Jupiter support look at recheck extension for JUnit Jupiter.
This project is licensed under the AGPL license.