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

  1. Download the TM4J/Junit integration repository from our Bitbucket.
  2. 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

  1. Add the dependency to your pom file for the Test Management for Jira JUnit library.

  2. Register the TM4J JUnit listener.
    This will generate the results file with test case keys.

  3. Add annotations to your JUnit tests for the test case key or name.

  4. Run the tests with this command:

    mvn test

    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.
Highlight search results