Changing the Test Case Detailed Report to show only latest test run

Thursday, April 19, 2018 3:06:42 PM

We had a request from a customer to change the built-in test case detailed report:

The Test Case Detailed report is very close to what we need, BUT it shows multiple test runs for a single test case.  When a test run results in a failure or a caution, even though there is a retest shown immediately after it, that’s not acceptable to the reviewing folks.

So in this post we include the XSLT template changes needed to accomplish this.

1 Replies
Thursday, April 19, 2018 3:21:47 PM
Avatar
re: inflectra.adam on Thursday, April 19, 2018 3:06:42 PM

The standard test case detailed report contains the following XSLT section that displays the list of test runs for the current test case:

       <xsl:if test="TestRuns/TestRun">
          <div class="Title4">
            Test Runs:
          </div>
          <table class="DataGrid">
            <tr>
              <th>Run #</th>
              <th>Tester</th>
              <th>Test Set</th>
              <th>Release</th>
              <th>Version</th>
              <th>Status</th>
              <th>Type</th>
              <th>Automation Host</th>
              <th>Est. Duration</th>
              <th>Actual Duration</th>
              <th>Execution Date</th>
            </tr>
            <xsl:for-each select="TestRuns/TestRun">
              <tr>
                <td>
                  TR<xsl:value-of select="TestRunId"/>
                </td>
                <td>
                  <xsl:value-of select="TesterName"/>
                </td>
                <td>
                  <xsl:value-of select="TestSetName"/>
                </td>
                <td>
                  <xsl:value-of select="ReleaseName"/>
                </td>
                <td>
                  <xsl:value-of select="ReleaseVersionNumber"/>
                </td>
                <td>
                  <xsl:value-of select="ExecutionStatusName"/>
                </td>
                <td>
                  <xsl:value-of select="TestRunTypeName"/>
                </td>
                <td>
                  <xsl:value-of select="AutomationHostName"/>
                </td>
                <td class="Timespan">
                  <xsl:value-of select="EstimatedDuration"/>
                </td>
                <td class="Timespan">
                  <xsl:value-of select="ActualDuration"/>
                </td>
                <td class="Date">
                  <xsl:call-template name="format-date">
                    <xsl:with-param name="datetime" select="EndDate" />
                  </xsl:call-template>
                </td>
              </tr>
              <xsl:if test="TestRunSteps/TestRunStep">
                <tr>
                  <td colspan="11">
                    <table class="DataGrid">
                      <tr>
                        <th>Step</th>
                        <th>Description</th>
                        <th>Expected Result</th>
                        <th>Sample Data</th>
                        <th>ActualResult</th>
                        <th>Status</th>
                      </tr>
                      <xsl:for-each select="TestRunSteps/TestRunStep">
                        <tr>
                          <td>
                            <xsl:value-of select="Position"/>
                          </td>
                          <td>
                            <xsl:value-of select="Description" disable-output-escaping="yes"/>
                          </td>
                          <td>
                            <xsl:value-of select="ExpectedResult" disable-output-escaping="yes"/>
                          </td>
                          <td>
                            <xsl:value-of select="SampleData" disable-output-escaping="yes"/>
                          </td>
                          <td>
                            <xsl:value-of select="ActualResult" disable-output-escaping="yes"/>
                          </td>
                          <td>
                            <xsl:value-of select="ExecutionStatusName"/>
                          </td>
                        </tr>
                      </xsl:for-each>
                    </table>
                  </td>
                </tr>
              </xsl:if>
            </xsl:for-each>
          </table>
        </xsl:if>

You would simply change the selector to only find the first match. I.e. you change:

            <xsl:for-each select="TestRuns/TestRun">

to

            <xsl:for-each select="TestRuns/TestRun[1]">

 

Statistics
  • Started: Thursday, April 19, 2018 3:06:42 PM
  • Last Reply: Thursday, April 19, 2018 3:21:47 PM
  • Replies: 1
  • Views: 92