Example Code

Determining the Termination Status of a TestStand Execution

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

Description

Overview

This example shows how to check the state of the execution, and change the behavior based on whether the execution is terminating.

 

Description

When you terminate a TestStand execution, the Cleanup step group for each executing sequence is still run in order to ensure that any shutdown code that may be present is executed.  In some cases, you may need to change the behavior of the shutdown code based on whether the execution is terminating or running normally.  To accomplish this, check the value of the following property:

 

RunState.Execution.GetStates (runState, termState)

 

The termState out parameter returns the current termination state of the execution.  the TestStand API Help provides detailed information of the possible values for each parameter:

 

TestStand API Reference Help: GetStates Method

 

Hardware and Software Requirements

Determining Termination Status - TS2012.seq

TestStand 2012 or Compatible

Determining Termination Status - TS2017.seq

TestStand 2017 or Compatible

Steps to Implement or Execute Code

  1. Open the attached sequence file, and run the MainSequence using Execute » MainSequence .
  2. When prompted, either click Continue to complete the execution normally or click the termination button to terminate the execution (alternatively, navigate to Debug » Terminate Execution) .
  3. Another dialog appears, indicating whether the execution was terminated.  Since this step is in the cleanup step group, it is executed in either case.

 

Additional Information or References

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

Comments
bienieck
Active Participant
Active Participant
on

How to do the similar thing but in PostBatch callback?

Michał Bieńkowski
CLA, CTA

Someone devote his time to help solve your problem? Appreciate it and give kudos. Problem solved? Accept as a solution so that others can find it faster in the future.
Make a contribution to the development of TestStand - vote on TestStand Idea Exchange.