Awesome
<a href="https://retest.dev"><img src="https://assets.retest.org/retest/ci/logos/recheck-screen.svg" width="300"/></a>
JUnit 4 extension for recheck. Automatic set up and tear down of tests using recheck.
Features
- Calls
startTest
on givenRecheckLifecycle
object before each test. - Calls
capTest
on givenRecheckLifecycle
object after each test. - Calls
cap
on givenRecheckLifecycle
object after each test.
Advantages
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.
Build tools
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.
Maven
<dependency>
<groupId>de.retest</groupId>
<artifactId>recheck-junit-4-extension</artifactId>
<version>${LATEST_VERSION_FROM_ABOVE_LINK}</version>
</dependency>
Gradle
compile 'de.retest:recheck-junit-4-extension:${LATEST_VERSION_FROM_ABOVE_LINK}'
Usage
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.
Recheck instance given during construction
// 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);
Recheck instance given during setup
@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);
}
Prerequisites
Requires JUnit 4. For JUnit Jupiter support look at recheck extension for JUnit Jupiter.
License
This project is licensed under the AGPL license.