How to Modify a TestStand XML Report Header
Primary Software: TestStand
Primary Software Version: 2014
Primary Software Fixed Version: N/A
Secondary Software: N/A
I want to add custom data to my TestStand report header when using the XML report format. What is the best way to do this?
TestStand's XML report depends on two files: the XML file that is created every time a test is run, and the XSL stylesheet that is created in advance and specified in the report options. Because of this, to modify the resulting report, we must change both the XSL stylesheet and the TestStand code that generates the XML file. This document discusses making a change to TestStand to take the value of a variable and add it to the top of the report header for the given sequence file. Before reviewing this document, it may be helpful to review information about XSLT and XPATH.
Note: The instructions for this KnowledgeBase start with the XSL file that ships with TestStand 2010 SP1. This XSL file is similar, but not necessarily identical, to the XSL file that ships with TestStand 4.2.x. Earlier versions of TestStand have XSL files that will most likely be somewhat different as the structure of the XSL file was reorganized for TestStand 4.2.x.
XML modifications using TestStand:
First, changes need to be made to the test sequence to save the value of a given variable to the generated XML file. Because we are making a modification to the report header, we can use the ModifyReportHeader callback to make the changes.
XSL modifications external to TestStand:
Now that the data has been added to the XML file, the XSL file must be modified to display the new data.
<font face = "VERDANA" size = "4" color= "#003366">
This will retrieve the value of the first Prop node (underneath the first Report node) that has the Name attribute of "CustomText " - this is the value we created in TestStand in the previous section. The value that is retrieved is formatted using the <font> tags. The value is selected by using XPath. If you are attempting to retrieve a different value than the one used in this example, take a look at the XPath Tutorial linked below to determine how to reference that value.
Community Example: Modify XML Report in TestStand
Documentation: Best Practices for NI TestStand Report Generation and Customization
KnowledgeBase 4SB7G6CK: TestStand XML Report Customization
TestStand Help: XML Report Style Sheets
TestStand Help: Sections in XML Report Style Sheets
TestStand Help: Customizing XML Report Style Sheets
External: XPath Tutorial
Report Date: 06/14/2010
Last Updated: 03/27/2017
Document ID: 5ADH53GU