Skip to main content

Junit 4

Installation

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

Maven

Add the dependency to your pom:

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

and add the following plugin:

and add the following plugins:

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.1</version>
<executions>
<execution>
<id>getClasspathFilenames</id>
<goals>
<goal>properties</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
<configuration>
<argLine>-javaagent:${com.nordstrom.tools:junit-foundation:jar}</argLine>
</configuration>
</plugin>

Gradle

In gradle, add the dependency and agent configuration as follows:

dependencies {
compile 'io.orangebeard:junit4-listener:<version>'
}
test {
jvmArgs "-javaagent:${classpath.find { it.name.contains('junit-foundation') }.absolutePath}"
testLogging.showStandardStreams = true
}

For more details on JUnit Foundation, see https://github.com/sbabcoc/JUnit-Foundation.

Configuration

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

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.