How to count number of testcases linked to BUG we have scriptrunner , Structure and Automation?
Hello @Sanjivani Wayal
Is "test case" an issue type?
What do you want to do with the count after you have obtained it?
You could use the Lookup Issue action in an Automation Rule to get the number of issues of a particular type linked to a given issue. After executing the Lookup Issues action the number of issues in the result set can be obtained with the smart value {{lookupIssues.size}}
Hi @Trudy P Claspill ,
Team wants to calculate how many testcases are attached to a bug (in a custom field) , yes i could use smart value {{lookupIssues.size}} but that will give me all the issues linked to BUG as we also have many test executions and other issues also linked, i particularly want to extract number of TESTCASES linked.
Iam looking how can we write in automation that the linked issue is a testcase?
Do you use a unique link type only to link test cases to bugs, or do you use a link type that is also used to link other types of issues together.
@Trudy P Claspill yes Test Case is issue type and team has already used same link for other issues types as well
You can use the ScriptRunner linkedIssuesOf() function to get a list of the issues.
https://docs.adaptavist.com/sr4jc/latest/features/scriptrunner-enhanced-search/jql-functions#linkedissuesof
issueFunction in linkedIssueOf("issue=the issue key for the Bug issue") and issuetype = "testcase"
Replace the issue key for the Bug issue with the actual issue key of the Bug issue for which you want to get the linked test cases.
Replace testcase with the actual name of your test case issue type.
That will get you a list of the linked test case for the specified Bug issue.
If you use that in a Lookup Issues action in an Automation rule then you can use the {{lookupIssues.size}} smart value to get the count of issues in the result set.
It looks like you're new here. Sign in or register to get started.