Creating the Custom Report

The following custom report can be used to generate a table of requirements along with the number of suspect test cases associated with them.

select TR.TEST_CASE_ID, TR.NAME, avg(TR.ACTUAL_DURATION) as AVERAGE_DURATION
from SpiraTestEntities.R_TestRuns as TR
where TR.PROJECT_ID = ${ProjectId} and TR.EXECUTION_STATUS_NAME <> 'Not Run'
group by TR.TEST_CASE_ID, TR.NAME

Then the following report template can be used to display the table:

<?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>Test Case Id</th><th>Name</th><th>Average Time</th></tr>
      <xsl:for-each select="ROW">
        <tr><td>TC:<xsl:value-of select="TEST_CASE_ID"/></td><td><xsl:value-of select="NAME"/></td><td><xsl:value-of select="AVERAGE_DURATION"/>s</td>
        </tr>
      </xsl:for-each>
        </table>
    </xsl:template>
</xsl:stylesheet>

Executing the Report

When you run the report in the sample project after you have modified several requirements linked to already approved test cases, you will see the following:

or if you want to export to Excel: