Awesome
<a href="https://retest.dev"><img src="https://assets.retest.org/retest/ci/logos/recheck-screen.svg" width="300"/></a>
JUnit Extension for recheck. Automatic set up and tear down of tests using recheck.
Features
- Calls
startTest
on allRecheckLifecycle
objects before each test. - Calls
capTest
on allRecheckLifecycle
objects after each test. - Calls
cap
on allRecheckLifecycle
objects after all tests.
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 lifecycle within a test using recheck.
Build tools
You can add recheck-junit-jupiter-extension as an external dependency to your project. It is available via the release-page which allows you to include it into your favorite build tool or via Maven central:
Maven
<dependency>
<groupId>de.retest</groupId>
<artifactId>recheck-junit-jupiter-extension</artifactId>
<version>${LATEST_VERSION_FROM_ABOVE_LINK}</version>
</dependency>
Gradle
compile 'de.retest:recheck-junit-jupiter-extension:${LATEST_VERSION_FROM_ABOVE_LINK}'
Usage
The recheck JUnit extension uses JUnit's extension mechanism. It can be used as a declarative extension by adding @ExtendWith(RecheckExtension.class)
to your test class or globally/automatically by adding a /META-INF/services/org.junit.jupiter.api.extension.Extension
file to your project with de.retest.recheck.junit.jupiter.RecheckExtension
as its sole contents and setting the junit.jupiter.extensions.autodetection.enabled=true
parameter e.g. in your pom.xml
or as a JVM system property.
Example
A simple example that will visit a page and capture it.
@ExtendWith(RecheckExtension.class)
public class SimpleTest {
private RecheckDriver driver;
@BeforeEach
void setUp() {
driver = new RecheckDriver(new ChromeDriver());
}
@AfterEach
void tearDown() {
driver.quit();
}
@Test
void hello_example_dot_com() {
driver.get( "https://example.com/" );
}
}
Prerequisites
Requires at least JUnit Jupiter. For JUnit 4 support look at recheck extension for JUnit 4.
License
This project is licensed under the AGPL license.