Calculating Pass Rate of Steps in the Main Sequence in TestStand

Updated Nov 20, 2025

Environment

Software

  • TestStand

This article outlines a method you can use to calculate the pass rate of steps in the main sequence. Currently, TestStand does not provide built-in APIs specifically for this purpose. You will need to implement your own functionality to count the number of passed and failed steps, and then calculate the pass rate accordingly.

The functionality will only apply to a specific sequence file. If you wish to apply the same functionality across multiple sequence files, you would need to create a customized Process Model, edit the relevant callbacks, and ensure that all sequence files use the same customized Process Model.

1. Launch NI TestStand and create a New Sequence File.

2. Go to Edit>>Sequence File Callbacks… and check the box for PostMainSequence Callback.


3. Go to the PostMainSequence callback sequence. In the Variables pane, add the following local variables:
a. Locals.TestPassed – Type: Number
b. Locals.TestFailed – Type: Number
c. Locals.Result – Type: Result


4. Add a For Each step. In the step settings:
a. Set Array to Iterate Over to:
RunState.Root.Locals.ResultList[0].TS.SequenceCall.ResultList
b. Set Current Element to: 
Locals.Result


5. Inside the For Each step, add a Statement step with the following expressions:
Locals.TestPassed += (Locals.Result.Status == "Passed") ? 1 : 0,
Locals.TestFailed += (Locals.Result.Status == "Failed") ? 1 : 0

6. (Optional) After the For Each step, add a Message Popup step with the following Message Expressions:
"The pass rate is: " + Str(Locals.TestPassed/(Locals.TestPassed + Locals.TestFailed)

The following image shows the result after running the sequence in Single Pass mode: