You can add to a sequence a step that dynamically runs one of two sequences, and you can pass parameters to the sequence you call.

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

Dynamically Specifying a Sequence to Run

Complete the following steps to open an existing sequence, add steps to prompt the operator for a CPU type and the number of CPUs to test, and add a step to call one of two different sequences depending on the type of CPU the user specifies.

  1. Open <TestStand Public>\Tutorial\Computer.seq.
  2. Select File»Save <filename> As and save the sequence as Computer6.seq in the <TestStand Public>\Tutorial directory.
  3. Click the Variables pane in the Sequence File window, right-click the Locals item, select Insert Local»String from the context menu, and name the local variable CPUType.
  4. Click the Steps pane in the Sequence File window to show the steps in the MainSequence.
  5. Insert a Message Popup step below the Power On step, rename the new step Select CPU Type, and complete the following steps to configure the Select CPU Type step.
    1. On the Text and Buttons tab of the Step Settings pane, enter the following values in the corresponding controls:
      • Message Expression"Please select the CPU type for the UUT."
      • Button 1"INTEL CPU"
      • Button 2"AMD CPU"
      • Cancel ButtonNone
    2. On the Layout tab of the Step Settings pane, enable the Make Modal option in the Dialog Options section. Enabling this option prevents the sequence editor from hiding the Select CPU dialog box and prevents you from interacting with the sequence editor until you close the Select CPU dialog box.
    3. On the Properties tab of the Step Settings pane, click Expressions to show the Expressions panel.
    4. In the Post-Expression control, enter the following expression to assign the string value "AMD" or "INTEL" to the local variable depending on the button users click:
      Locals.CPUType = ((Step.Result.ButtonHit == 2) ? "AMD" : "INTEL")
      Click the Check Expression for Errors button to verify that the expression contains valid syntax.
  6. On the Steps pane, insert a Message Popup step below the Select CPU Type step, rename the new step Specify Number of CPUs, and complete the following steps to configure the Specify Number of CPUs step.
    1. On the Text and Buttons tab of the Step Settings pane, enter the following values in the corresponding controls:
      • Message Expression"Please select the number of CPUs installed for the UUT."
      • Button 1"1"
      • Button 2"2"
      • Button 3"3"
      • Button 4"4"
      • Cancel ButtonNone
    2. On the Layout tab of the Step Settings pane, enable the Make Modal option in the Dialog Options section.
  7. Insert a Sequence Call step below the Specify Number of CPUs step, rename the step CPU Test, and complete the following steps to configure the CPU Test step.
    1. On the Module tab of the Step Settings pane, enable the Specify By Expression option.
    2. Enter Locals.CPUType + "Processor.seq" in the File Path or Reference control and "MainSequence" in the Sequence control.
    3. Click the Load Prototype button to launch the Load Sequence Prototype dialog box, in which you can select the prototype for the Sequence Call step.
    4. Click the Browse button in the Load Sequence Prototype dialog box and select <TestStand Public>\Tutorial\AMDProcessor.seq.
    5. Click OK to close the Load Sequence Prototype dialog box. TestStand populates the Parameters Table on the Module tab with the parameter list for the sequence.
    6. Click in the Value column of the CPUsInstalled parameter and enter the following expression:
      RunState.Sequence.Main["Specify Number of CPUs"].Result.ButtonHit
      Click the Check Expression for Errors button to verify that the expression contains valid syntax.
  8. Save the changes. Leave the sequence file open for the next tutorial.

Running a Sequence Dynamically

Complete the following steps to run a sequence dynamically.

  1. Place a breakpoint at the CPU Test step.
  2. Select Execute»Single Pass.
  3. Click Done in the Test Simulator dialog box.
  4. Click the INTEL CPU button in the Select CPU Type dialog box and click the 2 button in the Specify Number of CPUs dialog box.
  5. When execution suspends at the breakpoint on the CPU Test step, click the Step Into button on the Execution window toolbar to step into the MainSequence sequence in INTELProcessor.seq.
  6. Click the Call Stack pane. The call stack list shows INTELProcessor.seq at the top of the sequence call stack.
  7. Click the tab for the Variables pane of the Execution window and expand the Parameters item. The value of the CPUsInstalled parameter equals the value on the button you clicked in the Specify Number of CPUs dialog box. The MainSequence sequence in the INTELProcessor.seq sequence file also requires a ModelName parameter. The Sequence Call step you created did not specify the ModelName parameter, so the TestStand Engine initializes the parameter to the default name.
  8. Click the tab for the Steps pane of the Execution window and click the Resume button on the Execution window toolbar. When the execution completes, review the report but do not close the Execution window.
  9. Click the Restart button on the Execution window toolbar to restart the execution and click Done in the Test Simulator dialog box. The Execution window must be the active window to restart the execution.
  10. Click the AMD CPU button in the Select CPU Type dialog box and click the 3 button in the Specify Number of CPUs dialog box.
  11. When the execution suspends at the breakpoint on the CPU Test step, step into the MainSequence sequence in AMDProcessor.seq. The Call Stack pane lists AMDProcessor.seq at the top of the call stack.
  12. Resume and complete the execution and review the report.
  13. Close all the windows in the sequence editor.