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 184.108.40.206 installed to use the TM4J events/integration.
Review the ScriptRunner API options.
Begin this task in ScriptRunner for Jira.
Go to Settings > Manage Apps > Listeners > Create Listener.
A list of available listeners appears.
Click Custom Listener.
The Custom Listener template appears.
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.
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.
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.
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.
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.
|Tip:||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.|