Programmatically Determine the File Path and File Name of a TestStand Report

Updated Sep 21, 2018

Reported In

Software

  • TestStand

Issue Details

How can I find the file name and file path of my generated TestStand report programmatically?

Solution

The file path for the current TestStand report is created at run-time and is saved as a variable. Where this variable is located depends on the version of TestStand being used:

TestStand 2012 and Later: 

The report file path is most easily accessed through the GetReportFilePath callback.
This callback stores the report file path in the parameter Parameters.ReportFilePath.
With the file path, we can utilise the Split function to find the filename. 

TestStand 2010 SP1 and Previous: 

The specific variable to which the report file path is saved is dependent on the specific process model you are using. With the file path, we can utilise the Split function to find the filename. 
 

Sequential Model: 
RunState.Root.Locals.ReportFilePath 

 

Batch and Parallel Models:
RunState.Root.Parameters.TestSocket.ReportFilePath 

Additional Information

For TestStand 2012 and later the default process models uses a plugin architecture for reporting, hence why the report file path is easiest to access through the GetReportFilePath callback. This callback is executed after the client's MainSequence completes. To access the report file path elsewhere in the sequence, this value could be stored in a file global variable. 

For TestStand 2010 and prior, the variables have no data stored within them until run-time, checking for errors or evaluating an expression that uses these variables will result in an Unknown variable or property name error message.

WAS THIS ARTICLE HELPFUL?

Not Helpful