You want to ensure your team is delivering the best software possible. This can’t be done without a proper QA process. But to get Jira to support test case management, you have to create the right workflow to help your software development process run smoothly. One very helpful automation to start with is to display the number of test cases linked to each issue.
Why is this helpful?
- Get visibility over testing and quickly see how many tests are related to an issue
- Add QA traceability and reporting to Jira
Grab this script
int count = 0; string [] issues = linkedIssues(key, "Blocks"); for(string i in issues) { if(i.issueType == "Test Case") { count ++; } } customfield_10601 = count;
Step-by-step tutorial
To be able to display the number of test cases linked to issues on the issue screen, you have to have the following:
- An issue type called Test Case. If you’ve named your test cases by another name, you should make sure you include that in the script.
- A custom field to display the number of test cases. Keep note of this custom field’s ID to use in the script.
- The name of the Issue Link Type between your issues and test cases. You can obtain that from the Issue Features section in the Administration page.
- A listener function that automatically queries the test cases linked to an issue and updates the custom field.
Here’s how you can do that:
- Create a custom field. You can call it Linked Test Cases.
- Go to Manage Apps admin page and open SIL Manager.
- Create a new file and give it a descriptive name, such as “LinkedTestCases”.
- Paste in the script provided above.
- Edit the script to make it your own:
- Replace the name of the issue type in the highlighted text if you’ve named your test cases with another name: if(i.issueType == “Test Case“) {
- Replace the Issue link type in the highlighted text if the link type you’re looking to track is different than “Blocks”: string [] issues = linkedIssues(key, “Blocks“);
- Replace the ID of the custom field in the highlighted text with the ID of the custom field you created: customfield_10601 = count
- Set up the Power Scripts Listener function:
- Go to Manage Apps and select SIL Listener from the Power Apps Config Menu.
-
- Click on the Add listener button
-
- Add your script.
- Choose the user to run the script .
- Select the Issue Link Created event that the script should react to.
If you have any questions, reach out to our Support team to request support, report a bug, or suggest a feature.
The Script
int count = 0; string [] issues = linkedIssues(key, "Blocks"); for(string i in issues) { if(i.issueType == "Test Case") { count ++; } } customfield_10601 = count;