Simple Traceability Matrix

Wednesday, July 12, 2017
Avatar

Recently, our QA/regulatory decided to run an audit and they requested a traceability matrix that traces through requirements, tests, incidents and tasks.

Unfortunately, there are no ready-made SpiraTeam reports that does something like that so I had to write the template myself.

As this was my first attempt to create xml/xslt template (I am embedded s/w guy), it is inefficient but does work.

The template is based on "Requirements Detailed" template, so I suggest that if you were to use it, just clone the built-in template and replace the code with the one provided here.

Here's how the output looks like:

Req Name

Relationship

Related Req

Task ID

Test ID

Incident ID

Requirements

   

 

 

PRJ-SRS-0001

Depends-on

PRJ -PRS-001

TK5

TC101

IN201,

IN202

PRJ -SRS-0002

Depends-on

PRJ -PRS-002

TK6

TC102

IN204

PRJ -SRS-0003

Depends-on

PRJ -PRS-003

TK7

TC103

IN205,

IN207

 

Note that we are using custom requirements numbers in requirement name. The Software requirements are marked as SRS and project level requirements are marked as PRS.

 

Here's the template.

<?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="/RequirementData">
    <table class="DataGrid" style="width:100%">
      <tr>
        <th>Req Name</th>
        <th>Relationship</th>
        <th>Related Req</th>
        <th>Task ID</th>
        <th>Test ID</th>
        <th>Incident ID</th>
      </tr>
      <xsl:for-each select="Requirement">
        <tr>
           <xsl:if test="IsSummary='True'">
               <td>
                 <div class="Title2">
                    <xsl:value-of select="Name"/>
                 </div>
               </td>
               <td>
               </td>
               <td>
               </td>
               <td>
               </td>
               <td>
               </td>
               <td>
               </td>
           </xsl:if>       
           <xsl:if test="IsSummary='False'">
             <td>
               <xsl:value-of select="Name"/>
             </td>
             <td>
               <xsl:if test="Requirements/ArtifactLink">
                 <xsl:for-each select="Requirements/ArtifactLink">
                     <xsl:if test="position() > 1">, <br /></xsl:if>
                     <xsl:value-of select="ArtifactLinkTypeName"/>
                 </xsl:for-each>
               </xsl:if>
             </td>
             <td>
               <xsl:if test="Requirements/ArtifactLink">
                 <xsl:for-each select="Requirements/ArtifactLink">
                    <xsl:if test="position() > 1">, <br /></xsl:if>
                    <xsl:value-of select="ArtifactName"/>
                 </xsl:for-each>
               </xsl:if>
             </td>
             <td>
               <xsl:if test="Tasks/Task">            
                  <xsl:for-each select="Tasks/Task">
                      <xsl:if test="position() > 1">, <br /></xsl:if>
                      TK<xsl:value-of select="TaskId"/>
                  </xsl:for-each>
               </xsl:if>
             </td>
             <td>
               <xsl:if test="TestCases/TestCase">            
                  <xsl:for-each select="TestCases/TestCase">
                      <xsl:if test="position() > 1">, <br /></xsl:if>
                      TC<xsl:value-of select="TestCaseId"/>
                  </xsl:for-each>
               </xsl:if>
             </td>
             <td>
               <xsl:if test="Incidents/ArtifactLink">            
                  <xsl:for-each select="Incidents/ArtifactLink">
                      <xsl:if test="position() > 1">, <br /></xsl:if>
                      IN<xsl:value-of select="ArtifactId"/>
                  </xsl:for-each>
               </xsl:if>
             </td>
           </xsl:if>
         </tr>
      </xsl:for-each>
    </table>
  </xsl:template>
</xsl:stylesheet>

1 Replies
Wednesday, July 12, 2017
Avatar
re: Vladimir Wednesday, July 12, 2017

Thanks Vladimir.

Spira Helps You Deliver Quality Software, Faster and With Lower Risk

And if you have any questions, please email or call us at +1 (202) 558-6885

 

Statistics
  • Started: Wednesday, July 12, 2017
  • Last Reply: Wednesday, July 12, 2017
  • Replies: 1
  • Views: 2880