Skip to end of metadata
Go to start of metadata

ScriptRunner for Jira, a collection of powerful but easy-to-use workflow functions, JQL functions, listeners, and services, enables automation of a whole range of tasks in Jira and other tools in the Atlassian ecosystem. You can use Groovy to augment the scripts ScriptRunner provides, or you can write your own. By integrating ScriptRunner with TM4J, you can automate and customise TM4J even more to better suit your specific needs and make your testing efforts more accurate and efficient. 

You must have, at minimum, ScriptRunner version 5.6.8.1 installed to use the TM4J events/integration.

TM4J and ScriptRunner can currently be integrated in two ways: scripted fields and events/listeners.

Scripted Fields

ScriptRunner's custom scripted fields allow you to configure Jira issues specifically for your needs to give you a better, more comprehensive view of your testing effort.

For example, using ScriptRunner's scripted fields, you can view automated status updates of all your TM4J items, like test cases, in Jira. No more manual updates necessary. The field values are calculated automatically by ScriptRunner and never need manual maintenance, ensuring what you see is is an accurate reflection of your test cases statuses.

Check out Creating Script Fields with ScriptRunner for TM4J Data to learn how it's done and access example scripts.


You can also see the number of test cases linked to a Jira issue by expanding the TM4J panel while viewing a Jira issue. This integration with ScriptRunner, however, gives you another way to retrieve that information.

TM4J Events

The ScriptRunner integration with TM4J Server consists of opportunities created by TM4J events. Generally speaking, an event is “fired” when something happens inside an app. In this case, when one of three TM4J events fire, an opportunity is created for TM4J and ScriptRunner to interact with each other to complete useful tasks. Even more specifically, when one of the TM4J events fire, ScriptRunner is able to hear the event (using what are called "listeners") and subsequently trigger a script to run.

There are currently three TM4J events that can integrate and communicate with ScriptRunner. These events fire when the following actions occur in TM4J:

  • A test execution is updated (TestExecutionChangedEvent)
  • A test case is updated (TestCaseChangedEvent)
  • A test cycle is updated (TestCycleChangedEvent)

This integration allows you to create scripts in ScriptRunner that run when these TM4J events fire.

Here are some examples of what you can use the three TM4J events and the ScriptRunner integration to accomplish.

TM4J Scenario

ScriptRunner Action

TM4J Event

When a test execution is updated, I want to . . .

Transition any linked Jira issues/bugs to the proper status so my team knows which bugs are ready for retesting and which stories can be released

TestExecutionChangedEvent

Make sure my requirements accurately reflect the latest test execution 

When a test case is updated, I want to . . .Transition any linked Jira issues to the proper status so my team knows if the requirement is covered or notTestCaseChangedEvent

When a test cycle is completed, I want to . . .




Send an email notification to the test manager, so that they can keep up-to-date with the testing progress

TestCycleChangedEvent


Transition a linked issue to another status 

Update any linked Jira issues so that I can see the progress without viewing the test cycle

Ensure the progress of the cycle is traceable from the issue or Jira board 

Check out Creating Listeners in ScriptRunner for TM4J Events to learn more.

Also have a look at ScriptRunner's customer documentation about the TM4J integration. 

Did you know that you can use listeners in ScriptRunner to send emails and/or Slack notifications when a TM4J event occurs? For example, you can notify team members when a test case is approved, when a test cycle is completed, or when a test execution passes/fails. Sometimes it’s the small things that make a big impact.

  • No labels