Skip to end of metadata
Go to start of metadata

Annotating tests within a development project with the corresponding test case key in Test Management for JIRA enables results to be posted to JIRA in the following ways:

  • Running tests locally - using a pre-made script alongside the annotations
  • Running tests in Jenkins - using Test Management for JIRA Jenkins plugin 
  • Running tests in another CI tool - using a pre-made script within a task 

Note: Currently annotations are available for JUnit and Cucumber tests

Setting up the TM4J library for JUnit tests 

If you are using JUnit for your testing within a project, you will need to download the Test Management for JIRA automation library from our Bitbucket -

Once you have done this, follow the instructions in the Overview section to add the automation library to your project -

This will enable you to annotate your JUnit tests with a Test Management for JIRA key or name and will generate a custom report when you run the tests. 

To send these results to JIRA, you'll need to include a pre-made script (see the section below) which will take care of this for you. 

Alternatively, if you're using our Jenkins plugin, you can set up a task to do this for you. 

Using other CI tools will require a task and script to be included also. 

Annotating Tests


  1. Firstly, the JSON output format for Cucumber needs to be configured on the TestRunner class.

  2. Open the feature file that includes Cucumber tests in your project 
  3. Add an annotation for the test case name or key - @TestCase = ( name or key )

For an example of Test Management for JIRA integration with Cucumber, see here -


  1. Add the dependency to your pom file for the Test Management for JIRA JUnit libary 

  2. Register the TM4J JUnit Listener - this will generate the results file with test case keys included 

  3. Once this is set up, you can add annotations to your JUnit tests for the test case name or key - @TestCase = ( name or key ). 

  4. Now you can run the tests with this command and the TM4J test execution result file will be generated in the same execution folder:

    mvn test

For an example of Test Management for JIRA integration with JUnit, see here -

TM4J script for local testing/other CI tools 

If you are running your tests locally or within a CI tool other than Jenkins, you'll need to include this script so that the results can be posted to Test Management for Jira. 

For running automated tests locally, this will be within your project. 

For running automated tests within another CI tool, this can be added as a task/script within the tool itself to run after the build. 


#When using JUnit with the custom output file provided by the TM4J JUnit Listener
zip tm4j_result.json
curl --basic --user user:pass -F "" {your-jira-base-url}/rest/atm/1.0/automation/execution/{projectKey}?autoCreateTestCases=false

#When using Cucumber
zip target/cucumber/*
curl --basic --user user:pass -F "" {your-jira-base-url}/rest/atm/1.0/automation/execution/cucumber/{projectKey}?autoCreateTestCases=false

Have a question for us?

  • No labels