From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Example Code

Including Results of Subsequence Launched in New Thread in TestStand Report

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 to log the results of a sequence call executed in a new thread using a wait step

  

Description

When calling a subsequence from your TestStand sequence, you can optionally specify that the subsequence is run in a new thread, which allows the top level sequence to continue executing while the subsequence executes in parallel.  However, this introduces an issue when collecting the results of the subsequence.  For a traditional synchronous sequence call, the results for the sequence steps are propagated to the subsequence call step.  With an asynchronous call, however, the subsequence call step has already finished executing when the subsequence completes.  To address this, you can use a wait step in your calling sequence to wait for the subsequence to complete, and gather the results of the subsequence.  

 

Follow these steps to configure a wait step to wait on a subsequence executed in a new thread:

 

  1. Create a new wait step at the end of the top level sequence
  2. In the wait settings for the step, select Thread.
  3. Select Specify by Sequence Call, then select the subsequence call step from the drop-down, which is populated based on the steps in the current sequence

waitSettings.PNG

 

The wait step is now configured to wait for the new thread to complete, and will automatically gather the results of the thread.

 

threadReport.PNG

 

The attached example demonstrates this concept with a simple subsequence.

 

Requirements

Recording Results for a new Thread - TS2016

TestStand 2016 or compatible

  

Steps to Implement or Execute Code

  1. Open the attached sequence file in TestStand.
  2. Run the sequence using the Single Pass execution entry point.
  3. Observe that the report shows the results of the new thread in the wait step results.

 

Additional Information or References

 

**This document has been updated to meet the current required format for the NI Code Exchange.**

Jervin Justin
NI TestStand Product Manager

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

Comments
Murteaga
Member
Member
on

Very simple solution to a seemingly difficult problem. This also reduced execution time and improved test precision. Previously I had a wait and guessed how long it needed to be plus a little extra time to be sure I could capture the measurement.