Dynamically Change Report File Paths Based on UUT Results in TestStand

Updated Jun 20, 2023



  • TestStand

I want to generate separate log files for each UUT and change the directory/file path where they are stored based on the results of a step in my Main Sequence. What is the easiest way to do this in TestStand?

If you are using the sequential process model, follow the steps below:

  1. Assign the result value that you would like to use as a directory name to a StationGlobal variable in your MainSequence.
  2. Configure the report path to include this StationGlobal variable in the file path
    1. Navigate to Configure>>Result Processing>>Report Options>>Report File Pathname
    2. Select Generate Report File Path
    3. In the File/Directory Options drop-down menu, select Specify Report File Path by Expression
    4. In the Report File Path, you must include both the UUT and UUTStatus macros  . The UUT macro is necessary to create a separate report for each UUT and the UUTStatus macro is necessary to generate the report file path after calling the MainSequence callback. An example Report File Path is as follows: "$(ClientFileDir)\\" + StationGlobals.YourVariableName + "\\$(ClientFileName)_Report[$(FileTime)][$(FileDate)][$(UUT)][$(UUTStatus)].$(FileExtension)"
If you are using the parallel process model, this functionality is not currently supported by built-in features of TestStand but two options for possible workarounds are listed below:

Option 1: Generate a separate report for each UUT and then post-process the results by moving the reports into appropriate folder names. You can save the serial number of each UUT with its corresponding result from your MainSequence into a 2D array or similar data structure so that it can be used in a separate code module. Create a code module in LabVIEW, or the language of your choice, to create directory names based on the UUT test results and sort the UUT reports into their appropriate folders. You can then create a Process Model Plug-in that duplicates the NI_ReportGenerator plug-in but calls this code module in an action step in the cleanup section. This step should be called in the Model Plugins - End sequence call of the parallel process model which will allow the code module to sort all of the reports into their appropriate directories after all tests have been completed.

Option 2: Modify the Report File Path macros to create a separate lookup key for the UUT test results. In the same way that the UUTStatus macro is used to generate the report file path after the MainSequence has completeted, a separate macro containing information about the UUT test (e.g. the result info to be used as the file directory name) could be created to also generate the report file path after the MainSequence has run. 

Additional Information

It is not typically advisable to continuously rewrite a StationGlobal variable. However, since the method for the sequential process model uses the Report Options to configure the Report File Path, the only type of variable that can be accessed by both the MainSequence and the Report File Path options is a StationGlobal. This is due to the Report Options configuration being a part of the Report Generation Model Plugin which is called from the sequential process model sequence as opposed to the MainSequence.