NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Custom XML Report

Hi,
I have a requirement where I need to customise XML report generated by test stand. As far as I understood ,Test Stand generates XML report as XML Schema defined in Report.xsd file (in NI TestStand installation folder).
 
I need to generate a test report  strictly as per a custom XSD file (not the default one).
Is it possible in Test Stand 3.1?
If yes? What are the changes I need to make for achieving this?
or what is a better alternative?
 
I not so experienced in Test stand and it is urgent.
All suggestions will be highly appreciated .
 
Regards
 
SajK
0 Kudos
Message 1 of 9
(4,934 Views)

Hi

There are 2 ways you can generate a test report based on a custom XML schema

1. Generate the default XML report and apply a XSLT to the default XML report,  which will convert it to the new XML schema. This requires understanding the default TestStand XML schema and how data is stored in the report.

2. Write your own custom XML generator using the TestStand API and plug it into the process model to generate the new XML report. This requires knowledge in using TestStand's API and understanding how data is collected and stored in TestStand.  There is a lot of information of how to customize your report in the on-line help and other web documents including dev exchange.

I am not sure which is better for you but you might want to choose one over the other because of prior experience with a given technology.

Regards

Anand Jain

National Instruments

 

 

0 Kudos
Message 2 of 9
(4,923 Views)

Hi Anand,

Thanks for the reply.

I could not not find much useful topics on this topic.

Can you some links where I can get more information about the same.

Refering to the point 2 of your reply I want to clarify the following,

a.) whether is it possible to write custom XML generator using NI test stand commands and API alone? Or the custom XML generator should be developed in some ther programming language?

b.) Can provide some examples for XML reports in custom XSD.

Regards

SajK

0 Kudos
Message 3 of 9
(4,916 Views)
Hi
I have one quick question. Are you planning to come up with your own XSD for the report or are you trying to implement a standard XSD which is out there?

Answers to your questions

"I could not not find much useful topics on this topic. Can you some links where I can get more information about the same."

The topics I was referring to is for option 2. Most of the topics do not directly talk about how to generate a new report from scratch but they are related to customizing reports.

Some of them are in dev exchange and in the "using TestStand" manual.

In dev exchange I would do a search for topics which have "customize" and "report".

In the "Using TestStand" PDF (in TestStand 3.1 or greater) , look under chapter 10 for "customizing the report" to understand how reports are generated. This will help you generate your own report.

"a) whether is it possible to write custom XML generator using NI test stand commands and API alone? Or the custom XML generator should be developed in some ther programming language?"

You can use TestStand API in TestStand sequences to generate the new XML report, but I would suggest using the TestStand API in a programming language like LabVIEW or CVI.

"b.) Can provide some examples for XML reports in custom XSD."

If you have TestStand 3.1 I would suggest looking into "<TestStand>\Examples\ATML" example. In that example a custom XML report format is generated using the TestStand API and CVI

Regards

Anand Jain

National Instruments.

 

 

0 Kudos
Message 4 of 9
(4,901 Views)
SajK,

The XML reports that TestStand generates use style sheets (*.xsl) to set the format of the report.  The style sheets are found in the <TestStand>\Components\NI\Models\TestStandModels\StyleSheets\ directory.  If you look at the style sheet files, you will notice that building your own style sheet is not a trivial task.  The style sheet files use a mix of scripting and xml format directives.  However, it is certainly possible to create your own style sheet without having to modify the xml report generated by the process model.  The xml report should contain all the test information that you need, and you would only modify the xml report if you wanted to insert any additional information into the report.  You can select the style sheet from the report options configuration dialog.

For more information on stylesheets and xml formatting, check w3schools at http://www.w3schools.com/.

Regards,

Tyler Tigue
0 Kudos
Message 5 of 9
(4,894 Views)

Anand,

Thanks for suggestions..

I actually wanted to use my own XSD file. Not the standard one avialable with NI TestStand.

Then, where I need to make changes to get custom xml report?

Whether each time while generating the report, Test stand calls shchema file ( ie TestStand 3.1\Components\ NI\Models\ TestStandModels\ Report.XSD )?

Saju

0 Kudos
Message 6 of 9
(4,879 Views)
SajK,

I think in either case, SajK, you will have to implement your own code to integrate your XSD file with the xml report that is generated from TestStand.  In case of the second option, I beleive Anand is referring to the PropertyObject.GetXML function.  This will return the property object in the form of an XML string.  You can then check this with your XSD format.  To do so, you would have to implement your own code to convert the TestStand XML format to your XSD format and perform your report checking.

The other option is to use the XML report generated by TestStand and to use a stylesheet to convert the format.

If you want to generate your own report format from TestStand, the report is generated in the TestReport sequence call of the Process Model.  The TestReport generates the body of the report by calling the AddReportBody sequence of the reportgen_xml.seq which can be found in <TestStand>\Components\NI\Models\TestStandModels\.  Although, from looking at the code, it looks like the report is generated by calling GetXML on the ResultList property object.  You could put your own implentation in this file, or completely start from scratch by replacing the TestReport sequence.

Let me know if you have more specific questions.

Tyler T

Message 7 of 9
(4,857 Views)
SajK,

I also wanted to point out, if there is any confusion, the report generation process.  This information is provided in more detail in chapter 6 of the TestStand Reference Manual.  You can access the reference manual from the Sequence Editor by going to Help -> Search TestStand Bookshelf...

I'll give a brief description of report generation here.  As you may know, the report generation is handled in the Process Model.  The default Process Model files are stored in the <TestStand>\Components\NI\Models\TestStandModels\ directory.  However, each sequence contains the report data for the steps within the sequence.  The ResultList array in the Locals context holds the results of each executed step.  This includes information such as the step name, pass/fail result, error information, limits, and measurements.  Using the ResultList array of each of the sequences in your client SequenceFile, the Process Model generates a report.  For XML report generation, the Process Model generates a header and footer in xml format.  The header contains information such as current UUT, date/time, etc.  The report body is then generated.  The ResultList is also a Property Object, so GetXML is used to generate the body xml report.  The TestReport sequence in the Process Model is used to generate the report parts.  At the end of the TestReport sequence, the parts are appended together into one string that contains the entire xml report.

I point this out because what you are asking will require you to modify the Process Model and the report generation process.  I would take a look at chapter 6 of the Reference Manual to get a good understanding of report generation before you modify the file, however.

A final point I want to make concerns the XSD files.  Are you using the XSD files for validation?  The intent of the XSD file is to validate the data in an xml formatted file.  If you are using the XSD files for another purpose, could you please let us know?

Thanks,

Tyler T.
0 Kudos
Message 8 of 9
(4,848 Views)

Thanks Tyler,

These informations will be very useful for and I will go through the User manual chapters in detail.

I am using this for one specific requirement.Report XSD file is given to me.I need to generate XML report as per that.

Regards

SajK

 

0 Kudos
Message 9 of 9
(4,818 Views)