In this example we shall first create a list of all the requirements and their related test cases in the current project.

To do this

  1. Go to Administration  > Edit Reports
  2. Click Add new Report
  3. Specify that it should allow generating report file in MS-Word, Excel, HTML and PDF formats (upon need)
  4. Click on Add New Custom Section:
  5. Then add the 'Requirements' entity to the query. That will auto-generate the following:
select value R from SpiraTestEntities.R_RequirementTestCases as R where R.PROJECT_ID = ${ProjectId}

This will display a list of all the requirement coverage fields.
To display the test case custom fields as well as the basic fields, we need to join against the main test case entity:

select R.REQUIREMENT_ID, R.REQUIREMENT_NAME, R.TEST_CASE_ID, R.TEST_CASE_NAME, T.CUST_02
from SpiraTestEntities.R_RequirementTestCases as R
inner join SpiraTestEntities.R_TestCases as T on R.TEST_CASE_ID = T.TEST_CASE_ID
where R.PROJECT_ID = ${ProjectId}

However it will not include the display names of any custom list fields, only text ones. Custom list fields will display just the ID of the value, not the display name.

To display the name, we will need to join the R_CustomListValues entity to the results. We also will need to specifically select the columns we want from the main requirement entity:

select R.REQUIREMENT_ID, R.REQUIREMENT_NAME, R.TEST_CASE_ID, R.TEST_CASE_NAME, T.CUST_02, C.NAME
from SpiraTestEntities.R_RequirementTestCases as R
inner join SpiraTestEntities.R_TestCases as T on R.TEST_CASE_ID = T.TEST_CASE_ID
left join SpiraTestEntities.R_CustomListValues as C on cast (T.CUST_02 as int32) = C.CUSTOM_PROPERTY_VALUE_ID
where R.PROJECT_ID = ${ProjectId}

This will now display the requirement ID, requirement name, test case ID, test case name and one of the custom properties (ID and name).

Note that we had to explicitly cast the custom property value ID field to a string to match the way they are stored in the test cases entity.

Press on Create Default Template or simply copy the following code: 

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl">
  <xsl:template match="/RESULTS">
    <table class="DataGrid"><tr><th>REQUIREMENT_ID</th><th>REQUIREMENT_NAME</th><th>TEST_CASE_ID</th><th>TEST_CASE_NAME</th><th>CUST_02</th><th>NAME</th></tr>
      <xsl:for-each select="ROW">
        <tr><td><xsl:value-of select="REQUIREMENT_ID"/></td><td><xsl:value-of select="REQUIREMENT_NAME"/></td><td><xsl:value-of select="TEST_CASE_ID"/></td><td><xsl:value-of select="TEST_CASE_NAME"/></td><td><xsl:value-of select="CUST_02"/></td><td><xsl:value-of select="NAME"/></td>
        </tr>
      </xsl:for-each>
        </table>
    </xsl:template>
</xsl:stylesheet>

Click Save on both report pages, so to make it ready for use from Report Center.