Skip to main content

Junit 5

Installation

The source code can be found on GitHub: JUnit 5 Listener

Install the mvn package

Add the dependency to your pom:

<dependency>
<groupId>io.orangebeard</groupId>
<artifactId>junit5-listener</artifactId>
<version>version</version>
<scope>test</scope>
</dependency>

Configuration

For general usage of the extension, add or modify the surefire plugin:

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<configuration>
<properties>
<configurationParameters>
junit.jupiter.extensions.autodetection.enabled = true
</configurationParameters>
</properties>
</configuration>
</plugin>

Alternatively (or for use with your IDE), add junit-platform.properties containing:

junit.jupiter.extensions.autodetection.enabled = true

To also use the execution listener, so ReportEntries can be captured and reported, add test/java/resources/META-INF/services/org.junit.platform.launcher.TestExecutionListener and set its content to: io.orangebeard.listener.OrangebeardExecutionListener

You can also choose to extend individual classes with the extension class:

@ExtendWith(OrangebeardExtension.class)
public YourTestClass {
...
}

Create a new file named orangebeard.properties in the test resources folder. Add the following properties:

orangebeard.endpoint=<ORANGEBEARD-ENDPOINT>
orangebeard.accessToken=<XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX>
orangebeard.project=<PROJECT_NAME>
orangebeard.testset=<TESTSET_NAME>

# optional
orangebeard.description=<DESCRIPTION>
orangebeard.attributes=key:value; value;

Environment variables

The properties above can be set as environment variables as well. Environment variables will override property values. In the environment variables, it is allowed to replace the dot by an underscore. for example: orangebeard_endpoint as an environment variable will work as well.