Callbacks are sequences TestStand calls under specific circumstances. You can create new callbacks or you can override existing callbacks to customize the operation of the test station.

Note Completed solution files are located in the <TestStand Public>\Tutorial\Solution directory.

Process Model Callbacks

The process models contain sequences that define the operations TestStand performs before and after testing a UUT. You can use an Execution entry point, such as Test UUTs or Single Pass, to invoke sequences within a process model to execute a sequence in a sequence file you create. The process models also contain Model callbacks, which are sequences you can override to customize the behavior of a process model without editing the process model directly.

For example, the process models define a PreUUT callback sequence that prompts the user for a serial number before the test sequence executes. In most cases, this default behavior is sufficient. You can override the default PreUUT callback in a sequence file you create. When you override the default PreUUT callback and you use the Test UUTs or Single Pass Execution entry point to execute a sequence file, the process model calls the custom PreUUT callback in the sequence file instead of the default PreUUT callback in the process model.

The following figure shows the actions the default Sequential process model performs using callback sequences within the Test UUTs and Single Pass Execution entry points.

You can modify the process models or replace the models entirely to alter the behavior of the process models for all sequences.

Note To modify the installed process models or to create a new process model, copy all the process model files from the <TestStand>\Components\Models\TestStandModels directory to the <TestStand Public>\Components\Models\TestStandModels directory and make changes to the copy. Use the following guidelines when you copy installed files to modify:
  • You must rename the files after you modify them if you want to create a separate custom component. You must register any new or renamed ActiveX components.
  • You do not have to rename the files after you modify them if you only want to modify the behavior of an existing component.
  • If you do not rename the files and you use the files in a future version of TestStand, changes NI makes to the component might not be compatible with the modified version of the component.
  • Storing new and customized files in the <TestStand Public> directory ensures that installations of the same version of TestStand do not overwrite the customizations and ensures that uninstalling TestStand does not remove the files you customize.

Viewing Process Model Callbacks

Complete the following steps to examine the Model callbacks in the Sequential process model, which is the default process model TestStand uses to execute sequences.

  1. Open <TestStand>\Components\Models\TestStandModels\SequentialModel.seq.
  2. On the Sequences pane, select Test UUTs, which is the Execution entry point TestStand executes when you select Execute»Test UUTs. The Main step group of the Test UUTs sequence calls several callback sequences, including the following:
    • PreUUTLoop callback
    • PreUUT callback
    • MainSequence callback
    • PostUUT callback
    • PostUUTLoop callback
  3. Double-click the PreUUT Callback step, not the PreUUTLoop Callback step, to view the PreUUT callback sequence, which calls the DoPreUUT sequence.
  4. On the Sequences pane, select the DoPreUUT sequence. If the DoPreUUT Properties dialog box launches, click OK to close it. The DoPreUUT sequence includes an IdentifyUUT step and a Set Serial Number step.
    Note If you double-click the Call DoPreUUT step on the Steps pane of the PreUUT Callback sequence to try to open the DoPreUUT sequence, TestStand returns an error that it cannot open the sequence because TestStand evaluates an expression at run time to determine the sequence file path.
  5. Right-click the IdentifyUUT step and select Run Selected Steps from the context menu to launch the UUT Information dialog box, which is similar to the dialog box that launches when you execute a sequence using the Test UUTs Execution entry point. You can override the PreUUT callback with a custom callback to change the way TestStand obtains a UUT serial number, such as reading the serial number from a bar code instead.
  6. Click OK in the UUT Information dialog box.
  7. Close the Execution window.
  8. On the Sequences pane, select the Test UUTs sequence.
  9. Double-click the PreUUTLoop Callback step to open the PreUUTLoop callback sequence, which is empty because it is a placeholder. If you want to add steps that execute before the UUT loop, you can complete the steps in the section to override this callback.
  10. Close SequentialModel.seq and decline any prompts to save the changes.

Overriding a Process Model Callback

You can customize the functionality of a process model without making changes to the model itself. When you override a callback, the process model invokes the callback you create in a sequence file instead of the default callback in the process model.

Complete the following steps to override the default PreUUTLoop callback sequence in the Sequential model by creating a PreUUTLoop callback sequence in a client sequence file. Use this technique when you want to perform a task only once before operating on multiple UUTs, such as initializing hardware.

  1. Open <TestStand Public>\Tutorial\Computer4.seq, which you created in Using Variables and Properties.
  2. Select File»Save <filename> As and save the sequence file as Computer5.seq in the <TestStand Public>\Tutorial directory.
  3. Select Edit»Sequence File Callbacks to launch the Sequence File Callbacks dialog box.
  4. Enable the checkbox for the PreUUTLoop callback. Click OK to close the Sequence File Callbacks dialog box. The sequence editor creates a new empty callback sequence in the sequence file. Now, when you start an execution using an Execution entry point, TestStand calls the callback in the sequence file instead of the callback sequence in the Sequential process model file. The PreUUTLoop callback sequence becomes the selected sequence on the Sequences pane and opens in the Sequence File window.
  5. Insert a Message Popup step in the Main step group of the PreUUTLoop callback sequence and rename the new step Pre UUT Loop Callback Message.
  6. Enter the literal string "Now in the Pre UUT Loop Callback" in the Message Expression control.
  7. Save the changes and select Execute»Test UUTs. TestStand launches the Pre UUT Loop Callback Message dialog box.
  8. Click OK to close the Pre UUT Loop Callback Message dialog box. TestStand launches the UUT Information dialog box from the PreUUT callback sequence in the Sequential model. Enter a serial number and click OK.
  9. Run through several iterations of the sequence. TestStand launched the Pre UUT Loop Callback Message dialog box only once at the very beginning of the execution because the PreUUTLoop callback executes before the loop, and the PreUUT callback executes within the loop.
  10. Click Stop in the UUT Information dialog box.
  11. Close all the windows in the sequence editor.

The Parallel and Batch process models include similar callbacks that you can override.