Skip to content
Automatically administer lifecycle of JUnit 4 tests using recheck.
Java Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Build Status Latest recheck-junit-4-extension on Maven Central license PRs welcome code with hearth by retest

JUnit 4 extension for recheck. Automatic set up and tear down of tests using recheck.


  • Calls startTest on given RecheckLifecycle object before each test.
  • Calls capTest on given RecheckLifecycle object after each test.
  • Calls cap on given RecheckLifecycle 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.

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.




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.

Recheck instance given during construction

// Define RecheckLifecycle instance before Rule
private RecheckLifecycle re = new RecheckImpl();

// Let rule know which RecheckLifecycle instance should be administered
public RecheckRule recheckRule = new RecheckRule(re);

Recheck instance given during setup

public RecheckRule recheckRule = new RecheckRule();
private RecheckLifecycle re;

public void before() {
	re = new RecheckImpl();
	// Let rule know which RecheckLifecycle instance should be administered


Requires JUnit 4. For JUnit Jupiter support look at recheck extension for JUnit Jupiter.


This project is licensed under the AGPL license.

You can’t perform that action at this time.