Debugging Sequences

You can debug sequences by tracing, setting breakpoints and conditional breakpoints, stepping through code, and including watch expressions. Refer to Using the Watch View Pane for more information about watch expressions.

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

Step Mode Execution

Note Before you begin this tutorial, select Configure»Station Options to launch the Station Options dialog box, click the Execution tab, and confirm that the Enable Tracing and Allow Tracing into Setup/Cleanup options are enabled. Click OK to close the Station Options dialog box.

Setting a Breakpoint

Complete the following steps to set a breakpoint in a sequence file.

  1. Open <TestStand Public>\Tutorial\Computer2.seq, which you created in the previous tutorial.
  2. Select File»Save <filename> As and save the sequence file as Computer3.seq in the <TestStand Public>\Tutorial directory.
  3. Select Execute»Break on First Step to suspend an execution on the first step TestStand executes. A checkmark appears to the left of the menu option to indicate that you enabled this option.
  4. Expand the Cleanup step group on the Steps pane. Steps in the Cleanup step group execute regardless of whether the sequence completes successfully or whether a run-time error occurs in the sequence. If a step in the Setup or Main step group causes a run-time error to occur or if the operator terminates the execution, the flow of execution stops and jumps to the Cleanup step group. Steps in the Cleanup group always run even when some of the steps in the Setup group do not run. When a step in the Cleanup group causes a run-time error, execution continues to the next step in the Cleanup group.
  5. Insert a Message Popup step in the Cleanup step group and rename the step Cleanup Message.
  6. On the Text and Buttons tab of the Step Settings pane, enter "I am now in the Cleanup Step Group.", including the quotation marks, in the Message Expression expression control.
    Note
    • You must enclose literal strings in double quotation marks ("&mldr;") in any TestStand expression field.
    • For this example, use the default values for all the settings on the Options tab and the Layout tab of the Step Settings pane.
  7. Save the changes. Leave the sequence file open for the next tutorial.

Stepping through a Sequence File

When you suspend an execution, you can step through the sequence using the Step Into, Step Over, and Step Out buttons on the Execution window.

You can find these and other debugging tools in the Debug menu of the sequence editor.

Complete the following steps to step through an execution of the Computer3.seq sequence file you created in the previous tutorial.

  1. Select Execute»Run MainSequence. After the execution starts, the sequence editor immediately suspends at the first step of the sequence because you enabled the Break on First Step option in step 3 of the previous tutorial. The Execution window tab includes an execution pointer icon to indicate the running state of the execution. When the execution suspends, you can step through the sequence using the Step Into, Step Over, and Step Out commands at the top of the Execution window.
  2. Click the Step Over button to execute the Display Dialog step, which launches the Test Simulator dialog box.
  3. Select the RAM test to fail and click Done. After the Test Simulator dialog box closes, the sequence editor suspends the sequence execution at the end of the Setup step group on <End Group>.
  4. Insert a breakpoint at the CPU Test step by clicking to the left of the step icon. In the Execution window, a dark red icon appears to the left of the CPU Test step to indicate the breakpoint.
    Note To specify a conditional breakpoint, right-click the breakpoint icon and select Breakpoint»Breakpoint Settings to launch the Breakpoint Settings dialog box, in which you can specify an expression that must evaluate to True to activate the breakpoint. Click OK to close the Breakpoint Settings dialog box. Conditional breakpoints use an orange icon in the Sequence File and Execution windows. Disabled breakpoints use a gray icon. When you globally disable all breakpoints, the breakpoints use a white icon. Refer to Using Variables and Properties for more information about expressions.
  5. Click the Resume button to continue the execution. The sequence editor suspends the execution on the CPU Test step.
  6. Click the Step Into button to step into the MainSequence subsequence in CPU.seq, and click the Call Stack pane. If the Call Stack pane is not visible, click View»Debug»Call Stack to display it. Sequence call steps are similar to subVIs in LabVIEW and function or method calls in C/C++. When a step invokes a subsequence, the sequence that contains the calling step waits for the subsequence to return. The subsequence invocation is nested in the invocation of the calling sequence. The sequence that is currently executing is the most nested sequence. The chain of active sequences that wait for nested subsequences to complete is called the call stack. The first item in the call stack is the most-nested sequence invocation. The Call Stack pane displays the call stack for the execution thread currently selected on the Threads pane. A yellow pointer icon appears to the right of the most nested sequence invocation while the sequence executes, as shown in Figure 4-2.
  7. Select each sequence on the Call Stack pane to view each sequence invocation. Return to the most nested sequence invocation in the call stack, CPU.seq.
  8. Click the Step Over button to step through the CPU.seq subsequence one step at a time. Before you reach the end of the CPU.seq sequence, click the Step Out button. TestStand resumes the execution through the end of the current sequence and suspends the execution at the next step of the calling sequence or breakpoint, whichever comes first.
  9. Continue stepping through the Computer3.seq sequence by clicking the Step Over button until the Cleanup Message step you added to the Cleanup step group executes. You must step over each of the 10 loops of the Video Test step.
  10. Click OK to close the Cleanup Message dialog box and click the Step Over button to complete the execution. The Execution window dims when the execution completes. Do not close the Execution window.
  11. Click the Restart button to rerun the execution. The Execution window must be the active window to restart the execution.
  12. After the sequence editor suspends the execution on the first step, click the Terminate Execution button. TestStand launches the Cleanup Message dialog box even though you terminated the sequence execution. When an operator or run-time error terminates the execution, TestStand proceeds immediately to the steps in the Cleanup step group. Click OK to close the Cleanup Message dialog box. The Execution window dims when the execution completes.
  13. Click the Restart button to rerun the execution. The Execution window must be the active window to restart the execution.
  14. After the sequence editor suspends the execution on the first step, select Debug»Abort All (no cleanup). The execution of the sequence immediately stops, and TestStand does not execute any steps in the Cleanup step group.
  15. Save the changes and close all the windows in the sequence editor.