Xray's Document Generator has a Store with the most common templates. I added "Test Plan Advanced with Cover Page" report and found out that doesn't include Preconditions for every Test.
I tried to add it in document template:
#{for d=TestExecutions[n].TestRuns[a].PreConditionsCount}
@{title=${TestExecutions[n].TestRuns[a].PreCondition[d].Type}|href=${TestExecutions[n].TestRuns[a].PreCondition[d].Definition}}
#{end}
#{end}
but found nothing after report generation. How to add PreConditions info in Test Run?
Assuming that you're using Xray Cloud, where I could replicate your issue, the template is missing the Preconditions section indeed. I asked the team to update the template in the "store", ASAP. Meanwhile, you can download the template and modify it. Please add a section somehow like this (I've also added a screenshot to show how it looks in the template)
2.1.7. Pre-Condition
#{if (%{'${TestExecutions[n].TestRuns[a].PreConditionsCount}'>'0'})}
#{for c=TestExecutions[n].TestRuns[a].PreConditions}
Key
Summary
Condition @{title=${TestExecutions[n].TestRuns[a].PreConditions[c].Key}|href=${BaseURL}/browse/${TestExecutions[n].TestRuns[a].PreConditions[c].Key}}
${TestExecutions[n].TestRuns[a].PreConditions[c].Summary}
${wiki:TestExecutions[n].TestRuns[a].PreConditions[c].Conditions}
#{end}
#{end}
#{if (%{!('${TestExecutions[n].TestRuns[a].PreConditionsCount}' > 0)})}
None
#{end}