Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to get Xray Defects from Tests for an Xporter report?

Jeremy Jedlicka
Contributor
April 25, 2025

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?

 

1 answer

Suggest an answer

Log in or Sign up to answer
0 votes
Francisco Fonseca _Xray_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 12, 2025

Hi @Jeremy Jedlicka


Thanks for sharing your use case!

If I understood correctly you're trying to include defects per test in a Test Plan report and you’re entering an advanced usage pattern of Xporter templates that may require nested JQL clauses and dynamic loops. These setups can be quite sensitive to template syntax and execution context, especially when involving multiple levels of issue relationships like Test → Test Execution → Defect.

Since this may involve deeper troubleshooting on how your data is structured or how the template engine is interpreting your loops, I’d recommend reaching out to Xray Support directly.

They’ll be able to look at your specific instance and template in more detail.

Best,
Francisco

TAGS
AUG Leaders

Atlassian Community Events