One defect linked to multiple tests

Philipp Stark July 16, 2020

I need the number of all defects in a testplan. One defect can be linked to multiple tests but should only count as one. How can I do that? I can't use the JQL "defectsCreatedDuringTesting()" since some defects have to be created outside of a test. 

 

 

1 answer

0 votes
Nicolás Figueroa
Contributor
February 28, 2023

I have the same problem?

Do you were able to solve it?

Philipp Stark March 9, 2023

Hi and sorry for the long wait. 

I do it like this for each priority and in the ende I put the prior vars in a table. You get the total number of defects, and how many are in a given state.

Hope this helps.

 

${set(Prior1,0)}

${set(StatOpenPrio1,0)}

${set(StatClosedPrio1,0)}

${set(StatResPrio1,0)}

${set(StatInPPrio1,0)}

#{if (%{'${BulkIssueIndex}'==0})}

            &{for issues|filter=%{'${IssueTypeName}'.equals('Product defect')}}

            #{if (%{'${Priority}'.equals('1')})}

                        #{if (%{'${Status}'.equals('Open')})}

                                   ${set(Prior1,%{${Prior1}+1})}

                                   ${set(StatOpenPrio1,%{${StatOpenPrio1}+1})}

                        #{end}

                        #{if (%{'${Status}'.equals('Resolved')})}

                                   ${set(Prior1,%{${Prior1}+1})}

                                   ${set(StatResPrio1,%{${StatResPrio1}+1})}

                        #{end}

                        #{if (%{'${Status}'.equals('In Progress')})}

                                   ${set(Prior1,%{${Prior1}+1})}

                                   ${set(StatInPPrio1,%{${StatInPPrio1}+1})}

                        #{end}

                        #{if (%{'${Status}'.equals('Closed')})}

                                   ${set(Prior1,%{${Prior1}+1})}

                                   ${set(StatClosedPrio1,%{${StatClosedPrio1}+1})}

                        #{end}

            #{end}

            &{end}

#{end}

Nicolás Figueroa
Contributor
March 9, 2023

Thanks for the reply.

 

I got this solution from the support, using js, hope it help someone else:

${set(Count,0)}

${set(repeatp, “A”)}

#{for tc=TestsCount}

#{for s=Tests[tc].LinksCount|filter=%{‘${Tests[tc].Links[s].IssueType}’.equals(‘Bug’)}}

${set(Count,%{${Count} + 1})}

#{end}

#{end}

#{if (%{‘${Count}‘.equals(‘0’)})}

This Release has no Defects 

#{end}

#{if (%{!‘${Count}‘.equals(‘0’)})}

S. No.

Issue Key

${set(Count,0)}

#{for tc=TestsCount}

#{for s=Tests[tc].LinksCount|filter=%{‘${Tests[tc].Links[s].IssueType}’.equals(‘Bug’)}}

#{if (%{“${repeatp}”.indexOf(“${Tests[tc].Links[s].Key}”)==-1})}

${set(Count,%{${Count} + 1})}

${Count}

@{title=${Tests[tc].Links[s].Key}|href=${BaseURL}/browse/${Tests[tc].Links[s].Key}}

${set(repeatp,%{“${repeatp}”.concat(”${Tests[tc].Links[s].Key}”)})}

#{end}

#{end}

#{end}

#{end}

Like Philipp Stark likes this

Suggest an answer

Log in or Sign up to answer