Executing Sequences Using API - TestStand Expressions

Purpose

This example demonstrates various methods of calling a sequence using the TestStand API.

Note If you are developing a TestStand user interface which must handle TestStand UI messages, do not use the WaitForEndEx() method, since this method does not process the UI messages while it waits for the execution to complete. If you need to call this method from a user interface, you must call this method from a non-UI thread.

Example File Location

<TestStand Public>\Examples\TestStand API\Executing Sequences Using API\TestStand Expressions\Executing Sequences Using API.seq

Highlighted Features

  • TestStand API

Major API

  • Engine.GetSequenceFileEx
  • Engine.NewExecution
  • Engine.ReleaseSequenceFileEx

Prerequisites

None

How to Use This Example

Complete the following steps to review the sequences and steps in the example.

  1. Open Executing Sequences Using API.seq.
  2. On the Sequences pane, select the MainSequence. The MainSequence contains four Sequence Call steps that correspond to the different approaches demonstrated in this example.
  3. On the Sequences pane, select the Execute With No Process Model sequence. This sequence uses the Engine.GetSequenceFileEx and Engine.NewExecution methods from the TestStand API to open and execute a sequence file. Because this type of execution does not use a process model, it is similar to selecting Execute»Run MainSequence in the target sequence file.
  4. After execution completes, the Engine.ReleaseSequenceFileEx method releases the target sequence file. This is a necessary step for any sequence file loaded with the Engine.GetSequenceFile method.
  5. On the Sequences pane, select the Execute With Process Model sequence. This sequence loads a process model with the Engine.GetSequenceFileEx method and uses the Engine.NewExecution method to execute a client sequence file using one of the entry points from the process model.
  6. On the Sequences pane, select the Execute With Sequence Parameters sequence. This sequence passes parameters to the target sequence by using the Engine.NewPropertyObject, PropertyObject.SetValNumber, and PropertyObject.SetValString methods to create a container to store the parameters. The parameters must be declared in the same order they appear in the target sequence. Observe that the new PropertyObject container is passed to the Engine.NewExecution method as one of its parameters.
  7. Open Target Sequence File.seq.
  8. On the Sequences pane, select the MainSequence. This sequence includes a Message Popup step to indicate to the user that the sequence has executed.
  9. On the Sequences pane, select the Subsequence. Observe that this sequence includes two parameters, which are displayed in the Message Popup step.

Complete the following steps to run the example:

  1. Select Execute»Single Pass to run the sequence.
  2. As each section of code executes, the Message Popup from the target sequence appears. Click OK on these dialog boxes to continue execution.
  3. When the Execute With Sequence Parameters sequence executes, enter a number and string in the Message Popups that appear. Notice that these values are displayed in the final Message Popup.