Using Substeps

TestStand 2019 Help

Edition Date: May 2019

Part Number: 370052AA-01

»View Product Info
Download Help (Windows Only)

Substeps use substep code modules to define standard actions, other than calling the step code module, TestStand performs for all instances of the step type. Use the Substeps tab of the Step Type Properties dialog box to specify Pre-Step, Post-Step, Edit, and Custom substeps for the step type.

After you add a substep to a step type, click the Specify Module button in the Substeps tab to configure the substep module call. For each step that uses the step type, TestStand calls the same substep modules with the same arguments. You cannot add or remove substeps or otherwise alter the substep module call the substep performs when you configure a step instance.

Although you can specify any number of substeps for a step type, the list of substeps is not a sequence, and substeps do not have preconditions, post actions, or other execution options. The order in which Pre- and Post-Step substeps execute is the only execution option you specify.

Pre-Step Substep

TestStand calls the Pre-Step substep before calling the step code module. For example, a Pre-Step substep might call a substep code module that retrieves measurement configuration parameters and stores those parameters in step properties the step code module uses.

Post-Step Substep

TestStand calls the Post-Step substep after calling the step code module. For example, a Post-Step substep might call a substep code module that compares the values the step code module stored in step properties against limit values the Edit substep stored in other step properties. You can have multiple Post-Step substeps that execute in order.

Edit Substep

TestStand calls an Edit substep when you select the substep menu item from the Steps pane context menu. On the Substeps tab, select the Edit substep and click the Rename button to specify the name of the substep menu item and the caption of the button on the Step Type Edit tab of the Step Setting pane. If the Edit substep modifies any step properties, increment the change count of the sequence file by calling the PropertyObjectFile.IncChangeCount method so an editing application can determine that the file changed and refresh itself.

The Edit substep typically calls a substep code module that launches a dialog box in which you can edit the values of the custom step properties. For example, an Edit substep might launch a dialog box in which you specify the high and low limits for a test. The Edit substep might then store the high and low limit values as step properties.

Dialog boxes the Edit substep launches must be modal. Refer to the <TestStand Public>\Examples\Fundamentals\Launching a Modal Dialog directory for LabVIEW and Microsoft Foundation Class (MFC) examples of modal dialog boxes.

Note Note  You can initialize threads within TestStand executions to use the single-threaded apartment model or the multi-threaded apartment model. TestStand executes Edit substeps only in threads initialized using the single-threaded apartment model so the substep can open windows that contain ActiveX controls.
Note Note   An alternative approach to handle user input for your custom step type is to create a custom step type edit tab that displays in the Step Settings pane of your step instance. This approach requires the development of a custom .NET control for integration into the Sequence Editor.

Custom Substeps

With the exception of substeps named OnNewStep, TestStand does not call custom substeps. Use the TestStand API to invoke a custom substep from a code module or user interface. You can create a custom substep named OnNewStep for TestStand to call each time you create a new step of that type. For example, the built-in If step type uses an OnNewStep substep to insert a matching End step. The OnNewStep substep can cancel the insertion of the step by setting the Step.CancelCurrentExecution property to True.

The <TestStand>\Components\StepTypes directory includes source code for many of the substep modules the built-in step types use. To modify the installed step types or to create a new step type, copy the step type source code from the <TestStand>\Components\StepTypes directory to the <TestStand Public>\Components\StepTypes directory and make changes to the copy of the source code.


Not Helpful