Here are two methods for setting a timeout for steps in TestStand
Setting a timeout for all steps
- Open TestStand and Click on Configure/Stations Options
- Click on the Time Limits section, and you will see the set time limitsĀ
- Enable Set a Time limit for this operation, and set the Time limit needed
- This enables a timeout for all steps in the sequence.
- When time expires, there are four actions: Prompt for action/Terminate Execution/Abort Execution/Kill the threads

Setting a timeout for specific steps
- Open the sequence and click on the step you want to modify
- Click the properties in the steps settings and choose expressions
- Add the following to the pre-expression, and you can select the handling method according to needs
-
// Set a 5s time limit for the step before execution and chooseTerminate when timeout
RunState.Engine.StationOptions.SetTimeLimitEnabled(TimeLimitType_NormalExecution, TimeLimitOperation_Executing, True),
RunState.Engine.StationOptions.SetTimeLimitAction(TimeLimitType_NormalExecution, TimeLimitOperation_Executing, TimeLimitAction_Terminate),
RunState.Engine.StationOptions.SetTimeLimit(TimeLimitType_NormalExecution, TimeLimitOperation_Executing, 5)
- Add the following to the post-expression
-
Add below into Post-expression:
// Set the time limit to false after the step execution
RunState.Engine.StationOptions.SetTimeLimitEnabled(TimeLimitType_NormalExecution, TimeLimitOperation_Executing, False)