Applies to TM4J Cloud, last modified on April 22, 2020.
Annotating JUnit tests in a TM4J development project enables results to be sent from JUnit directly to Jira. All it takes is a pre-made script within a task.
This topic illustrates the workflow, explains how to configure the TM4J library for JUnit tests, and walks you through how to properly annotate JUnit tests.
Workflow: TM4J and JUnit
Here's how the components work together:
Configure the TM4J Library to Receive JUnit Test Results
- Download the TM4J/Junit integration repository from our Bitbucket.
- Add the automation library to your project by following the instructions in the README section.
This enables you to annotate your JUnit tests with a TM4J key or name and generate a custom report when you run tests.
To send the test results to Jira, you'll need to include a pre-made script (see the task below).
Annotating JUnit Tests
- Add the dependency to your pom file for the Test Management for Jira JUnit library.
- Register the TM4J JUnit listener.
This will generate the results file with test case keys.
- Add annotations to your JUnit tests for the test case key or name.
Run the tests with this command:
The TM4J test-execution-result file generates in the same execution folder.Finally, if you want to see an example of the TM4J integration with JUnit in action, we've got you covered.