JUnit Integration

Applies to Zephyr Scale Server/Data Center 8.0, last modified on March 25, 2021

If you use JUnit for your testing, complete the following two steps.

First, add the dependency to get access to the JUnit listener and the annotations to your pom.xml file.

XML

<dependencies>
    <dependency>
        <groupId>com.adaptavist</groupId>
        <artifactId>tm4j-junit-integration</artifactId>
        <version>1.0.0</version>
        <scope>test</scope>
    </dependency>
</dependencies>

Next, register the Zephyr Scale JUnit Listener. This listener generates the correct JSON output file needed for uploading to Zephyr Scale.

XML

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.22.0</version>
            <configuration>
                <properties>
                    <property>
                        <name>listener</name>
                        <value>com.adaptavist.tm4j.junit.ExecutionListener</value>
                    </property>
                </properties>
            </configuration>
        </plugin>
    </plugins>
</build>

This enables you to annotate your JUnit tests with a Zephyr Scale key or name, which then generates a custom report when you run the tests.

To send these results to Jira, use the script provided here.

Alternatively, if you use our Jenkins plugin, you can create a task to do this for you. A task and a script is also required if using other CI tools.

Tip: Want to know more about annotating JUnit tests and testing locally? We got you.

See Also

Integrations
Annotations With Other CI Tools/Running Locally

Highlight search results