Example Code

TestStand: Generate a report for each SubSequence

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • Teststand

Code and Documents

Attachment

Overview

This example demonstrates how you can use sequence calls with the use new execution option to generate separate reports for individual subsequences. 

 

Description

This example generates a separate report for each subsequence called by the main sequence.  Additionally, the subsequence reports are added to the Active Report menu in the report view so they can be easily viewed after the test executes.  The example implements this functionality

 

  • Configure the sequence call to use a new execution using rhe Execution Options menu in the Module tab.
  • In the advanced settings, configure the following options:
    • set Wait for Execution to Complete option to Before executing next step.  This ensures that the sequence calls are still executed sequentially despite using a new execution.
    • Set the Additional Execution Type Mask setting to ExecTypeMask_InitiallyHidden.  This ensures that a new tab is not shown for the execution.
    • Specify a local variable in the Store an Object Reference to the New Execution in field.  TThis will be used to access the report object and add it to the report collection of the main execution.
  • Create a post expression to move the generated report to the main execution.  This is done so that the report can be viewed by changing the Active Report selection in the report viewer.

    RunState.Execution.Reports.InsertExisting(Locals.execRef.AsExecution.Report,-1)

After making these changes, each subsequence will generate a separate report viewable in the report viewer:

 

 seperatereports.png

 

Hardware and Software Requirements

TestStand 2014 or Compatible 

 

Steps to Implement or Execute Code

  1. Run the attached sequence file using Execute » Single Pass.
  2. Observe that the report is empty, but other reports are present in the Active Report drop-down.
  3. Select each of the other reports to view the individual subsequence results.

 

Rich Roberts
Senior Marketing Engineer, National Instruments
Connect on LinkedIn: https://www.linkedin.com/in/richard-roberts-4176a27b/

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.