How Can I Skip to a Specific Step in a TestStand Sequence?

Updated Jun 13, 2018

Reported In


  • TestStand

Issue Details

I want to be able to skip or jump to a specific step from my sequence based on a condition, for example, if any or a specific run-time error occurs. Can I skip to a specific step inside of a TestStand sequence, even if the step is in a step group that has already executed?


You can use the Post Actions of any step and / or a Goto step type allow to jump to another step in a sequence.
  • In a Goto step, simply choose the desired step from the drop-down labeled Destination Step.
  • In the Post Actions of a normal step you must first check the Use Custom Condition box and then choose Goto Step from the drop down under the On Condition True or On Condition False section (you may choose different steps depending on the step result this way). Then, you can choose your destination step from the second drop-down in the section you chose.

For example, you can check the value of the Step.Result.Error.Code property of any step and jump to a specific step  if a specific run-time error occurs, or the Step.Result.Error.Occurred property instead for any run-time error.

Normally this process allows you to only go to any step in the current, or next step group, but not to a previous step group.  However you can use the RunState.NextStepIndex and RunState.StepGroup properties to jump to a previous step group. RunState.NextStepIndex contains the zero-based index of the desired step that follows the currently executing step in the step group indicated by RunState.StepGroup. By modifying the value of these properties, you can specify the step that TestStand executes next. For example, if you are in the Main step group and you want to make TestStand jump to the first step in the Cleanup sequence, you can have the following expression in a Statement step:

RunState.NextStepIndex = 0, RunState.StepGroup = "Setup"

The valid values for the RunState.StepGroup property are: SetupMain and Cleanup.

Additional Information

The Post Action method can be combined with the SequenceFilePostStepRuntimeError Engine Callback for more flexible approaches. Refer to Handling TestStand Runtime Errors and the Overriding SequenceFilePostStepRuntimeError Callback TestStand shipping example for more information about the SequenceFilePostStepRuntimeError Engine Callback.

This solution doesn't work for versions prior to TestStand 2.0.


Not Helpful