Overview

Test cases can optionally be part of one or more test sets. When test cases are executed, incidents may be created.   It is also important to keep in mind that the test cases are organized into a folder structure. Therefore, one request may be to identify both the test sets associated with the test sets for planning purposes and the incidents arising from the test case execution.

Data Setup

Here is an example of a Test Case to Test Set setup and Test Case to Incident setup for a currently failed test case.

Example of a Test Case mapped to Test Set

Test Case to Test Set Mapping

 

 

 

 

 

 

Example of a Test Case mapped to Incident

Test Case to Incident Setup

 

 

 

 

 

 

Report Creation Steps

  1. Go to the Administration section
  2. Go to the "Edit Reports" under the system settings
  3. Add a new report
  4. Give it a name
  5. Select the appropriate category (Test Case Reports)
  6. In the standard section of the report, please select "Test Case Details"
  7. Insert the attached XSLT into the "Template" section.
  8. Save the section 
  9. Save the report

XSLT

<?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">

  <!-- ========================================================= -->
  <!-- Key to identify unique Test Sets within each Test Case    -->
  <!-- ========================================================= -->
  <xsl:key name="TestSetByTestCase"
           match="TestRun[TestSetId]"
           use="concat(generate-id(ancestor::TestCase[1]), '|', TestSetId)"/>

  <xsl:template match="/TestCaseData">
    <div class="Title3">Failed Test Cases with Linked Incidents</div>
    <xsl:for-each select="TestCaseFolder">

      <!-- Only folders containing failed test cases -->
      <xsl:if test="TestCases/TestCase[ExecutionStatusName='Failed']">

        <div class="Title2">
          Folder: <xsl:value-of select="Name"/>
        </div>

        <table class="DataGrid">
          <tr>
            <th>Test Set(s)</th>
            <th>Folder</th>
            <th>Test Case ID</th>
            <th>Test Case Name</th>
            <th>Execution Status</th>
            <th>Linked Incidents</th>
          </tr>

          <xsl:for-each select="TestCases/TestCase[ExecutionStatusName='Failed']">
            <xsl:sort select="TestCaseId" data-type="number"/>
            <tr>

              <!-- ========================================= -->
              <!-- Test Sets (unique within Test Case)        -->
              <!-- ========================================= -->

              <td>
                <xsl:choose>
                  <xsl:when test="TestRuns/TestRun[TestSetId]">
                    <xsl:for-each select="
                      TestRuns/TestRun
                      [
                        generate-id()
                        =
                        generate-id(
                          key(
                            'TestSetByTestCase',
                            concat(generate-id(ancestor::TestCase[1]), '|', TestSetId)
                          )[1]
                        )
                      ]">

                      <xsl:sort select="TestSetId" data-type="number"/>
                      <xsl:value-of select="concat(TestSetId, ' - ', TestSetName)"/>
                      <xsl:if test="position()!=last()">
                        <br/>
                      </xsl:if>
                    </xsl:for-each>
                  </xsl:when>
                  <xsl:otherwise>-</xsl:otherwise>
                </xsl:choose>

              </td>

              <!-- Folder -->
              <td>
                <xsl:value-of select="../../Name"/>
              </td>

              <!-- Test Case ID -->
              <td>
                <xsl:value-of select="TestCaseId"/>
              </td>

              <!-- Test Case Name -->
              <td>
                <xsl:value-of select="Name"/>
              </td>

              <!-- Execution Status -->
              <td>
                <xsl:value-of select="ExecutionStatusName"/>
              </td>

              <!-- Linked Incidents -->
              <td>
                <xsl:choose>

                  <xsl:when test="Incidents/Incident">
                    <xsl:for-each select="Incidents/Incident">
                      <xsl:sort select="IncidentId"
                                data-type="number"/>

                      <xsl:value-of select="concat(IncidentId,
                                                   ' - ',
                                                   Name,
                                                   ' - ',
                                                   IncidentStatusName)"/>

                      <xsl:if test="position()!=last()">
                        <br/>
                      </xsl:if>
                    </xsl:for-each>
                  </xsl:when>
                  <xsl:otherwise>
                    None
                  </xsl:otherwise>
                </xsl:choose>
              </td>
            </tr>
          </xsl:for-each>
        </table>
      </xsl:if>
    </xsl:for-each>
  </xsl:template>
</xsl:stylesheet>

XSLT Explanation

  1. Starts at the XML root (TestCaseData).
  2. Examines each test case folder.
  3. Includes only folders containing failed test cases (ExecutionStatusName = 'Failed').
  4. Includes only failed test cases within those folders.
  5. Eliminates duplicate Test Set references using an XSLT key (TestSetByTestCase and later iterating for TestRuns).
  6. Reports the current execution status for each failed test case.
  7. Lists all linked incidents for each failed test case, ordered by Incident ID.
  8. Displays a placeholder when no Test Set or Incident information is available.
  9. Use "-" if no Test Sets are associated with a Test Case
  10. Concatenate Test Set ID - Test Set Name if available
  11. Use "None" if no Incidents exists for a "Failed" test case
  12. Concatenate "Incident ID  - Incident Name - Incident Status" if available

Report Output

Given below is an example of a Test Case with associated Test Sets and Incidents under the root folder

Failed TC with associated TX and IN details