How to count number of testcases linked to BUG

Sanjivani Wayal
Contributor
September 29, 2023

How to count number of testcases linked to BUG we have scriptrunner , Structure and Automation?

1 answer

0 votes
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 29, 2023

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}}

Sanjivani Wayal
Contributor
October 2, 2023

Hi @Trudy 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?

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 3, 2023

Is "test case" an issue type?

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.

Sanjivani Wayal
Contributor
October 3, 2023

@Trudy Claspill yes Test Case is issue type and team has already used same link for other issues types as well 

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 3, 2023

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.

Sanjivani Wayal
Contributor
October 3, 2023

testcasecount.PNG

@Trudy Claspill  I tried to use the filter Project = "projectname" and issuetype = Test and issueFunction in linkedIssuesOf("issuekey")

and the automation as above its inserting some random value 100 and it updates the value in testcases and not in BUG issuetype

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 4, 2023

Please show us the exact filter that you created. Are you trying to use a smart value in that filter, or an explicit issue key?

Please show us the details of the Schedule trigger.

If your Schedule trigger includes a JQL then each action in the rule will be executed against each issue returned by that JQL. If you have added a JQL to the trigger that retrieves test cases, then it is the Test Case issues that will be updated by the Edit Issue action.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events