Test Management for Jira Server

Creating Listeners in ScriptRunner for TM4J Events

We’re excited to announce that TM4J, Test Management for Jira, is now part of the SmartBear family. Learn more.

The following steps illustrate how to create listeners in ScriptRunner for TM4J events.
Example scenarios and scripts are outlined below.

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

Review the ScriptRunner API options.

Begin this task in ScriptRunner for Jira.

  1. Go to Settings > Manage Apps > Listeners > Create Listener.
    A list of available listeners appears.

  2. Click Custom Listener.
    The Custom Listener template appears.

  3. Complete the following fields:

    • Project(s) - Select the project or projects for which you want to create the listener.

    • Events - Select one or more of the available TM4J events (TestExecutionChangedEvent, TestCaseChangedEvent, and/or TestCycleChangedEvent).

    • Inline Script - Add your script to the text box. You can copy/paste pre-made scripts from the Adaptavist Library, too.

      tm4j sr event listeners server
  4. Click Add.
    The listener is created.

After you create a listener, the integration is complete.

At any point, you can return to ScriptRunner’s Listeners section and view the executed listener actions.

Example Scenarios and Scripts

Here are some example scripts using TM4J events and Java APIs.

TM4J Scenario ScriptRunner Action Example Script

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.

See the script on the Adaptavist Library.

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 not.

See the script on the Adaptavist Library.

When a test cycle is completed, I want to…​

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

See the script on the Adaptavist Library.

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.