Inside SpiraTeam or SpiraTest, go to Administration > System > Edit Reports.
Now do the following:
- Create a new custom report
- Give it a name and description
- You can leave the header and footer blank for now
- Enable the various formats that you want to be made available (typically include HTML and Excel for this kind of tabular report)
- Set the category as "Test Case Reports"
- Add a standard section. Choose the 'Test Case Details' as the section.
- Paste the XSLT code displayed below into the Template field
- Now save the section
- Now save the report
The XSLT template to use is as follows:
<?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="/TestCaseData">
<table class="DataGrid" style="width:100%">
<tr>
<th>Test #</th>
<th>Name</th>
<th>Status</th>
<th>Last Executed</th>
<th>Execution Count</th>
</tr>
<xsl:for-each select="TestCase">
<tr>
<td>
<xsl:value-of select="TestCaseId"/>
</td>
<td>
<xsl:attribute name="style">
padding-left: <xsl:value-of select="string-length(IndentLevel)*2"/>px;
</xsl:attribute>
<xsl:if test="FolderYn='Y'">
<b>
<xsl:value-of select="Name"/>
</b>
</xsl:if>
<xsl:if test="FolderYn='N'">
<xsl:value-of select="Name"/>
</xsl:if>
</td>
<td>
<xsl:value-of select="ExecutionStatusName"/>
</td>
<td class="Date">
<xsl:call-template name="format-date">
<xsl:with-param name="datetime" select="ExecutionDate" />
</xsl:call-template>
</td>
<td>
<xsl:value-of select="count(TestRuns/TestRun)"/>
</td>
</tr>
</xsl:for-each>
</table>
</xsl:template>
<xsl:template name="format-date">
<xsl:param name="datetime"/>
<xsl:variable name="date" select="substring-before($datetime, 'T')" />
<xsl:variable name="year" select="substring-before($date, '-')" />
<xsl:variable name="month" select="substring-before(substring-after($date, '-'), '-')" />
<xsl:variable name="day" select="substring-after(substring-after($date, '-'), '-')" />
<xsl:variable name="time" select="substring-before(substring-after($datetime, 'T'), '.')" />
<xsl:variable name="monthname">
<xsl:choose>
<xsl:when test="$month='01'">
<xsl:value-of select="'Jan'"/>
</xsl:when>
<xsl:when test="$month='02'">
<xsl:value-of select="'Feb'"/>
</xsl:when>
<xsl:when test="$month='03'">
<xsl:value-of select="'Mar'"/>
</xsl:when>
<xsl:when test="$month='04'">
<xsl:value-of select="'Apr'"/>
</xsl:when>
<xsl:when test="$month='05'">
<xsl:value-of select="'May'"/>
</xsl:when>
<xsl:when test="$month='06'">
<xsl:value-of select="'Jun'"/>
</xsl:when>
<xsl:when test="$month='07'">
<xsl:value-of select="'Jul'"/>
</xsl:when>
<xsl:when test="$month='08'">
<xsl:value-of select="'Aug'"/>
</xsl:when>
<xsl:when test="$month='09'">
<xsl:value-of select="'Sep'"/>
</xsl:when>
<xsl:when test="$month='10'">
<xsl:value-of select="'Oct'"/>
</xsl:when>
<xsl:when test="$month='11'">
<xsl:value-of select="'Nov'"/>
</xsl:when>
<xsl:when test="$month='12'">
<xsl:value-of select="'Dec'"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="''" />
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:value-of select="concat($day, '-' ,$monthname, '-', $year , ' ', $time)" />
</xsl:template>
</xsl:stylesheet>
Now when you run this report, you will see the following:
Test # | Name | Status | Last Executed | Execution Count |
---|
1 | Functional Tests | N/A | 30-Nov-2003 | 0 |
46 | Test 1 for Demo | Failed | 08-May-2015 | 1 |
47 | Nouveau scénario de test | Not Run | -- | 0 |
2 | Ability to create new book | Failed | 14-May-2015 | 15 |
3 | Ability to edit existing book | Blocked | 08-May-2015 | 6 |
4 | Ability to create new author | Failed | 12-Jun-2015 | 10 |
31 | New Test Case (Ability to report on books on loan) | Passed | 17-Jul-2015 | 2 |
32 | Test that the system lets you report | Not Run | -- | 0 |
5 | Ability to edit existing author | Passed | 01-Jun-2015 | 3 |
6 | Ability to reassign book to different author | Passed | 30-Nov-2003 | 1 |
38 | Create New Book - Automated | Not Run | -- | 0 |
43 | Mobile Test for Demo | Not Run | -- | 0 |
39 | Performance Tests | N/A | 01-Jun-2015 | 0 |
72 | Ability to edit existing author - copy | Passed | 01-Jun-2015 | 3 |
40 | Verify load times of home page | Not Run | -- | 0 |
7 | Regression Tests | N/A | 30-Nov-2003 | 0 |
8 | Book management | Passed | 30-Nov-2003 | 1 |
9 | Author management | Passed | 30-Nov-2003 | 1 |
29 | Rapise New Tests | N/A | 31-Mar-2015 | 0 |
30 | Test Case 1 | Not Run | -- | 0 |
34 | MS-Paint Test | Passed | 31-Mar-2015 | 6 |
48 | Library Test 1 | Not Run | -- | 0 |
49 | Sample Windows App | Not Run | -- | 0 |
42 | Conference Web Test 1 | Not Run | -- | 0 |
10 | Scenario Tests | N/A | 28-May-2015 | 0 |
11 | Exception Scenario Tests | N/A | 28-May-2015 | 0 |
12 | Person loses book and needs to report loss | Blocked | 28-May-2015 | 1 |
13 | Adding new book and author to library | Not Run | -- | 0 |
15 | Common Tests | N/A | 30-Nov-2003 | 0 |
16 | Open Up Web Browser | Passed | 30-Nov-2003 | 0 |
17 | Login to Application | Passed | 30-Nov-2003 | 0 |
33 | Tests that you can copy book editions | Failed | 17-Jul-2015 | 2 |
35 | New Test Case (Additonal Edition Functionality) | Not Run | -- | 0 |
36 | New Test Case (Ability to link authors to their contact information) | Not Run | -- | 0 |
37 | New Test Case (Ability to associate authors with subjects) | Not Run | -- | 0 |
41 | New Test Case (System needs to be able to report on aging) | Failed | 13-May-2015 | 2 |
50 | Tests that we can add new subjects to the system | Not Run | -- | 0 |
51 | New Test Case (Ability to edit existing subjects in the system) | Not Run | -- | 0 |