I'm trying to modify the stock Test Plan report to include a column that lists defect keys in the Test Summary Table. I'm running into the problem that to get the defects I either need to provide the requirements, or executions from the test. This requires a nested for loop, which I can't figure out.
This is what I'm working with:
${prop(xporter.document.autofit,true)}
Key | Summary | Issue Assignee | Requirements | Defects | #TestExecutions | Latest Status |
${set(TestKeyIncluded, 'A')}
#{for tests}
#{if (%{'${statusesToShowFirst}'.trim().equals('') || ‘${statusesToShowFirst}’.contains(‘${Tests[n].TestStatus}’)})}
${set(TestKeyIncluded,%{'${TestKeyIncluded}'.concat('${Tests[n].Key},')})}@{title=${Tests[n].Key}|href=${BaseURL}/browse/${Tests[n].Key}} | ${Tests[n].Summary} | #{if (%{!'${Tests[n].Assignee}'.equals('')})} ${fullname:Tests[n].Assignee} #{end} | #{for a=JQLIssuesCount|clause=key in testRequirements('${Tests[n].Key}')}
${JQLIssues[a].Key}
#{end} | #{for a=JQLIssuesCount|clause=key in testRequirements('${Tests[n].Key}')}
${JQLIssues[a].Key}
#{end} | ${jqlcount:issue in testTestExecutions('${Tests[n].Key}') and 'Test Plan' = ${Key}} | #{if (%{'${Tests[n].Latest Status}'.equals('FAIL')})}
${Tests[n].Latest Status}
#{end}
#{if (%{'${Tests[n].Latest Status}'.equals('PASS')})}
${Tests[n].Latest Status}
#{end}
#{if (%{'${Tests[n].Latest Status}'.equals('TODO')})}
${Tests[n].Latest Status}
#{end}
#{if (%{'${Tests[n].Latest Status}'.equals('EXECUTING')})}
${Tests[n].Latest Status}
#{end}
#{if (%{'${Tests[n].Latest Status}'.equals('ABORTED')})}
${Tests[n].Latest Status}
#{end} |
I've tried to iterate through what is pulling in the requirements:
#{for a=JQLIssuesCount|clause=key in testRequirements('${Tests[n].Key}')}
${JQLIssues[a].Key}
#{end}like this:
#{for a=JQLIssuesCount|clause=key in testRequirements('${Tests[n].Key}')}
#{for b=JQLIssuesCount|clause=key in defectsCreatedForRequirement(${JQLIssues[a].Key})}
${JQLIssues[b].Key}
#{end}
#{end}
Any suggestions on how to list defects on the Test Summary table in the Test Plan Xporter Report?