1 Exercise 1: Add Tests Using NI TestStand Sequence Editor Objective: To create a TestStand sequence and add steps to the MainSequence that uses the Frequency test created in the first three exercises. The TestStand Sequence Editor is a graphical user interface (GUI) for creating and modifying sequence files. You use the sequence editor to add steps to a sequence file to create a test sequence for the handheld device. Exercise 1A: Edit Audio Quality Test VI Properties 1. Follow these steps to make a working copy of the VI that you created in the previous exercise: a. Open Audio Quality Test.vi in your Exercises folder. b. Select File»Save As, select Substitute copy for original, and click Continue. a. Name the VI Audio Quality Test.vi and click OK. 2. Now you will need to edit the VI so that it will output the result of the Pass terminal to TestStand. a. Click on the top right box of the connector. b. Then left-click on the Pass Boolean indicator on your front panel. This associates the Pass Boolean control with the selected terminal of your VI. 3. Now, resize the VI front panel to only show the Waveform Graph for the signal and frequency analysis and Pass Boolean indicator. If you need to move your controls, indicators or graphs, be sure to click on the outside of the control, not on one of the resizing squares. When the VI is called as a popup panel by TestStand, only the waveform graph will be visible. 4. The final change that you need to make to the VI is to change the window appearance. a. Navigate to File»VI Properties. b. On the resulting dialog window, select Window Appearance in the Category drop-down box. c. Select the Dialog radio button. d. Select OK to save changes.
2 e. Run the VI to see how the window appears. f. Save the VI and then close the VI. g. Leave LabVIEW open and continue. Figure 1 Audio Quality Test VI Dialog Box Exercise 1B: Create a TestStand Sequence and Add the Frequency Test Step 1. Select Start»Programs»National Instruments»TestStand [version number]»sequence Editor. 2. After the TestStand Sequence Editor opens, a login dialog will appear. There is no password. Click OK. Each time you open the Sequence Editor, you will be prompted to login. Tip: You can control access to specific TestStand capabilities based on the user login level. Using an interactive user manager environment, you add, remove, and edit users, their passwords, access levels, and profiles. In this case, when you log in as an administrator, you have access to all TestStand sequence editor capabilities. Figure 2 Login Dialog Box
3 3. The TestStand Sequence Editor should appear as in the following figure. The areas of the sequence editor are labeled below. Sequences Pane Steps Pane Insertion Palette Template Area Step Setting Pane Figure 3 TestStand Sequence Editor 4. Now you will confirm that the execution process model is correct for this exercise. In this case, you will use the Sequential execution process model. a. Select Configure»Station Options and select the Model tab. b. Use the Station Model drop-down to select SequentialModel.seq or click the browse button, to go to C:\Program Files(X86)\National Instruments\TestStand [version number]\components\models\teststandmodels and select SequentialModel.seq. c. Click OK on the Station Options window to return to the Sequence Editor.
4 5. To add a new step you will first have to select the LabVIEW adapter which allows you to call and run LabVIEW VI code modules from TestStand. To select the LabVIEW adapter, simply click the LabVIEW icon at the top of the Insertion Palette. Figure 4 LabVIEW Icon on Insertion Palette 6. Now you will insert the first step in the test sequence, which will test the sound quality of the handheld device. The test will return a Boolean value for the pass/fail result, so the type of test you want is a pass/fail test. a. Click the + sign in the Insertion Palette next to the Tests folder. b. Drag and drop a Pass/Fail Test from the Insertion Palette to the Main step group in the Steps pane as shown in the following image. Figure 5 Addition of Pass/Fail Test Step 7. Double-click on the Pass/Fail Test step to edit the test step s name. Rename the step Audio Quality Test.
5 8. Now that you ve selected the type of step, you will need to specify which LabVIEW VI this step calls. You will use the LabVIEW VI that you saved earlier in this exercises as the code for this test. a. When you click on the Audio Quality Test step, the Step Properties pane automatically updates with the step s properties. b. Click on the Module tab in the Step Setting pane. This will allow you to choose the code module, in this case a LabVIEW VI, that you want to associate with this step. c. Click the File Browse button on the right to open Select a Pathname for the Step s Code Module. Figure 6 Select a Pathname for the Step's Code Module Dialog Box d. Select the Audio Quality Test.vi file from your Exercises directory, and click Open to return to the Edit LabVIEW VI Call dialog box. e. If a File Not Found dialog appears, select Use an absolute path for the file you selected and click OK. 9. Now that you have selected the VI, you will need to define where to store the test result in TestStand. a. Notice that the Description and Connector Pane now shows the VI icon with a Boolean output terminal. This output is available to TestStand because of the edit you made to the connector pane of the VI earlier in Part A of this exercise. Figure 7 Description and Connector Pane
6 b. Click the Value field for Pass Boolean parameter and click the Expression Browse Dialog Box button to the right. You can use the Expression Browser Dialog Box to interactively build an expression by selecting from lists of variables, properties, operators, and functions. c. In this case, navigate the properties of the step and select Step.Result.PassFail. Click Insert to select that property. Figure 8 Edit LabVIEW VI Call Dialog Box d. Step.Result.PassFail is the TestStand property that will now contain the Pass value. e. Click OK again to return to the sequence editor window. 10. In order to see how the test is executing you will have to show the front panel of the VI. a. Select the checkbox for Show VI Front Panel When Called. 11. You have finished adding the first step to your test sequence.
7 Exercise 1C: Run the Sequence 1. Now that you have created your first test sequence, you can execute your test sequence. Select Execute»Single Pass. 2. Select Yes to save the sequence file. Name the sequence file Ex 1 Handheld Test.seq in the Exercises folder. 3. The test sequence will now execute. You should see the Audio Quality Test VI appear on the screen. If the VI passed, the test step will pass, if the VI failed the test step will fail. 4. A report for your test sequence will automatically be generated. 5. To run another test, click Execute»Restart. Figure 9 UUT Report 6. Close the Single Pass window by selecting Window»Close Completed Execution Displays when you are finished. End of Exercise 1
8 Exercise 2: Add Tests Using Preconfigured Step Templates Objective: To complete a TestStand sequence by adding steps to the MainSequence using built-in TestStand preconfigured step templates. You will build on the sequence file you created in the previous exercise. Preconfigured step templates allow you to easily create and store preconfigured templates of the steps you created in the Sequence Editor. These templates can be used to quickly build sequences based on commonly used steps. Exercise 2A: Create Your First Template 5. If you closed the sequence you created in the last exercise, reopen it. c. Open Ex 1 - Handheld Test.seq in your Exercises folder. 6. In the last exercise, you completed your first test sequence by adding your first step. Now we are going to use that step to create a step template. a. In the Templates Area, expand the Steps folder by clicking the + sign. This will reveal another folder, Multifunction Handheld Device Tests. b. Expand the Multifunction Handheld Device Tests folder by clicking the + sign. This will reveal a list of the preconfigured step templates. Figure 1 Templates Window
9 c. In the MainSequence, click and drag your step, Audio Quality Test, into the Multifunction Handheld Device Tests folder to create a new template. Figure 2 Creating a Template Step You have now created your first template. You can drag this template into your sequence file to reuse it at a later time. Exercise 2B: Create a TestStand Sequence and Add the Template Steps 12. Create a new sequence file for the complete handheld test. a. Select File»New Sequence File to create a new sequence file. b. Select File»Save and save the file as Ex 2 Complete Handheld Test.seq in your Exercises folder. 13. Add steps to the Setup step group. The Setup step group runs before the Main step group. This step group should be used for initialization steps, such as turning instruments and other devices on. For our example, we will initialize and configure all of our test machines. a. Click the + sign next to Setup step group in the Steps pane to expand the Setup step group.
10 b. Drag the Initialize Instrumentation template from the Insertion Palette into the Setup step group. This will create a step using the template that has been created for you. 14. Add steps to the Main step group. Figure 3 Adding a Template Step The Main step group is where the bulk of the work should be performed by your test sequence. For our example, we will perform all of our tests in the Main step group. a. Click the + sign next to the Main step group in the Steps pane to expand the Main step group. b. Drag the Power Consumption Test step template into the Main step group. The power consumption test will verify whether the phone stays within an acceptable range for power consumption. If this test fails, we do not want to run any of the other tests. c. Under the Insertion Palette, click the + sign next to Flow Control to expand the flow control steps. Flow control steps allow developers to control the order of execution of steps in a TestStand Sequence with constructs such as While Loops and If statements. d. Drag an If step type under the Power Consumption Test. Click the If step. The Step Settings window will update to show the If step properties. Click the Condition Builder button on the right to build a condition for the step.
11 e. Select Power Consumption Test under the Insert Step Status dialog. Click the Insert Step Pass button to insert a condition in the statement. This will build the condition in the If step that is true if the Power Consumption Test passes. If the test fails, nothing inside of the If statements will run. Figure 4 Condition Builder Dialog Window f. Click OK to exit the Condition Builder. g. Drag the LED Test template into the Main step group, inside of the If block. This test will test the LED of the handheld device. h. Drag the Volume Test underneath the LED Test. This will test that the volume of a signal from the phone is within an acceptable range. i. Drag an If step type under the Volume Test. This will create a nested If block. Follow step d to create a Pass condition that checks the Volume Test instead of the Power Consumption Test. j. Drag the Audio Quality Test template inside the new If block. Because the test is within the new If block, TestStand will only run the Audio Quality Test if the Volume Test passes. The Audio Quality Test step is the step you created previously. k. Drag the Bluetooth Test template underneath the new End step. l. Drag the Wi-Fi Test template underneath the Bluetooth Test step. m. Drag a For step type from the Flow Control menu underneath the Wi-Fi Test. A For step type will allow you iterate over a group of steps a specified number of times. The step settings dialog will automatically change to the For Loop parameters. n. Enter the number 4 in the Number of Loops text box. This will tell the loop how many times it should iterate.
12 o. Click the Expression Browser Dialog Box button next to the Loop Variable dialog box. This will show the Expression Browser Dialog Box which allows you to build an expression. Right-click on word Locals in the tree shown and select Insert Number. This will create a local number variable. Name the variable ImpactTestCount. p. Click the Insert button to build your expression. Locals.ImpactTestCount will now appear in the expression window. q. Click OK to insert Locals.ImpactTestCount as the expression. This variable will keep track of how many times the loop has iterated. r. Drag the Impact Test template inside of the For Loop. 15. Add steps to the Cleanup step group. The Cleanup step group runs after the Main step group. As its name implies, it should be used to provide cleanup for the tests that have been performed in this sequence. For this test, we will turn off all of our test instruments in this step group. a. Click the + sign next to Cleanup to expand the Cleanup step group. b. Drag the Turn Off Instrumentation template into the Cleanup group. c. Your sequence should resemble the following. Figure 5 Complete Handheld Sequence
13 Exercise 2C: Run the Completed Sequence 7. Now that you have completed the entire test sequence, you can execute test your handheld device. Select Execute»Single Pass. If prompted, select Yes to save the sequence file. 8. View the test results. 9. To run another test, click Execute»Restart. 10. Close the Single Pass window by pressing the Close button on the window or selecting Window» Close Completed Execution Displays when you are finished. End of Exercise 2
14 Exercise 3: Debug Test Sequence Using the NI TestStand Sequence Editor Objective: To become familiar with using breakpoints and debugging tools in the sequence editor. When you create a sequence file, you might want to observe sequence execution to make sure the sequence behaves as you need. During debugging, you might want to observe execution in some sections of a sequence but not others. In this exercise, you want TestStand to execute the sequence until it reaches a section you want to analyze. TestStand allows you to insert convenient stopping points, known as breakpoints, in the sequence. Like most modern development systems, TestStand allows you to set and remove multiple breakpoints for every sequence file. Exercise 3A: The Step Debugging Tools 7. In the sequence editor, select File»Open and open the Ex 2 Complete Handheld Test.seq you created earlier. 8. Left-click the space to the left of the LED Test to set a breakpoint on that test. A red stop icon appears, as shown below, to indicate the breakpoint. Figure 1 Breakpoint Set 9. Click the Run button on the sequence editor toolbar. This executes the sequence using the Test UUTs Execution entry point.
15 10. Enter any number into the UUT Information dialog box and click OK. 11. Notice that the execution pauses at the first breakpoint, in this case, the LED Test, because you inserted a breakpoint at this step. The step into, step over, and step out debugging tools should be enabled on the toolbar. 12. Click the Step Over button to move to the next step. 13. Click the Resume button to continue execution. 14. Before the execution completes, click the Terminate button to terminate the execution and display the results of all steps executed in the report. If your execution reaches the UUT Result dialog before you have a chance to terminate, start a new UUT and then terminate the execution. 15. Click Terminate in the Testing Terminated for Current UUT dialog box that launches. 16. Close the report and return to the Sequence File window. Exercise 3B: Stepping into a Code Module 1. Click Run to run the sequence again. Enter any number in the UUT Information dialog box. 2. When the execution pauses at the LED Test step, this time press the Step Into button. 3. Notice how the LabVIEW VI LED Test.vi has now opened. Change to the block diagram by selecting Window»Show Block Diagram. 4. Right-click on the wire between the Divide VI and the Add VI. Select Set Breakpoint to set a breakpoint. Figure 2 Set a Breakpoint in LabVIEW 5. Click the white Run button in LabVIEW to execute the code module. Notice that the LabVIEW code breaks at the breakpoint you set. 6. Move the mouse cursor over the wire to see the pointer change to a Probe icon. Clicking on the wire will allow you to see the value at this point during run-time. 7. Click the red button labeled Continue, to continue execution of the code module.
16 8. Once the LabVIEW code module has finished executing, right-click on the breakpoint you set and select Clear Breakpoint. Figure 3 Clearing a Breakpoint 9. To return execution to TestStand, press the black Return to caller button. 10. When the focus returns to TestStand, press the Resume button to finish the TestStand execution. 11. Close the report and the sequence file. Do not save. End of Exercise 3
17 Exercise 4: Integrating Switching into the Sequence Using NI Switch Executive Objective: To add switching to each step such that the appropriate instruments connect to each component on each device under test (DUT). In this exercise, you will make use of the integration of NI Switch Executive in NI TestStand. Additional Information: NI Switch Executive is an intelligent switch management and routing application. You can interactively configure and name switch modules, external connections, and signal routes using a graphical end-to-end route editor. This means you can preconfigure routes or autoroute signal endpoints on the switch. This exercise illustrates configuring a TestStand step to automatically perform the switching operations for the step based on a configuration created in NI Switch Executive. Exercise 4: Add Switching to the Audio Quality Test Step 1. Follow these steps to make a working copy of the sequence that you created in the previous exercise. a. Open Ex 2 - Complete Handheld Test.seq in your Exercises folder. b. Select File»Save As. c. Name the sequence Ex - 4 Switching.seq and click Save. 2. The following steps will show you how you can specify which switch routes to connect when executing the Audio Quality Test in your sequence. a. Click on the Audio Quality Test step to highlight it. This will automatically populate the Step Settings pane at the bottom of the sequence editor b. Select the Properties tab to open the Step Properties dialog box for the step as shown in the next figure. Figure 3 Step Settings Pane c. Click the Switching option on the properties group list and the Step Setting pane will populate as shown in the next figure.
18 Figure 2 Step Settings Pane Showing Switching Properties d. To set the switching configuration for the step, check the Enable Switching check box. e. Select HandheldDeviceSwitch from the Switch Executive Virtual Device ring control. Now that you have selected the HandheldDeviceSwitch virtual device, all of its routes and route groups are available for you to use. To test ONLY the filter on DUT0, the route group that you want to use is AudioQualityDUT0. You could simply select that route as the Route(s) to Connect and this test will work fine for one DUT. But ultimately this sequence will need to be able to test multiple DUTs, and selecting a static route doesn t offer the scalability that you need when you want to use this same sequence to test multiple DUTs. Therefore, with the end result in mind, you will add this route using an expression so that the route used during the step will change for the DUT being tested. f. Click on the f(x) button next to Route(s) to Connect to open the Expression Browser and type the following expression. AudioQualityDUT + Str(RunState.TestSockets.MyIndex)
19 Figure 3: Expression for Audio Quality Test Switch Route in Expression Browser Dialog Box This expression is used because the switch route now depends on one thing: the DUT being tested. All of the possible path combinations have already been pre-defined in the virtual device: AudioQualityTestDUT0, AudioQualityTestDUT1, AudioQuailtyTestDUT2, and AudioQualityTestDUT3. RunState.TestSockets.MyIndex is the index of the current execution in TestStand which equates to the DUT to be tested. Remember, this expression is used in anticipation of the next exercise in which multiple DUTs will be tested. g. Click OK to return to the Sequence Editor. h. The Connection Lifetime is set to Manual which means that the route will disconnect whenever you do so in another step. i. Set the Connection Lifetime to Step which disconnects the routes when the step completes.
20 Figure 4 Audio Quality Test Properties for Switching j. Observe the changes in the MainSequence. If you receive an Evaluation or Syntax Error, return to the Expression Browser to determine and correct the problem. Notice that the Audio Quality Test step now has a Switch listed in the Flow Properties column. Figure 5 Switch Configured for Audio Quality Test 3. Run and save the sequence to guarantee that the sequence is executing correctly. a. Select File»Save. b. Click on Execute»Single Pass. c. The sequence should execute just as it did before. This is because, much like we are using a simulated digitizer, we are using a simulated switch in this exercise. d. In future exercises we will see how this switching configuration will be able to scale to test four different handheld devices. 4. Close the sequence by selecting File»Close. 5. You have successfully added switching to the Audio Quality Test.
21 End of Exercise 4
22 Exercise 5: Test Handheld Device Using an NI TestStand Run-Time Operator Interface Objective: To run a test sequence file from the operator interface and view reports that TestStand generates. In addition to the sequence editor application to execute a test in the previous exercise, you can also use the operator interface to execute tests. The operator interface in this exercise is built with LabVIEW and is the interface the operator uses on the production floor. The operator interface is similar to the sequence editor because it has most of the same functionality. The operator interface and the sequence editor have the following differences: The sequence editor can modify or create sequence files. The operator interface cannot modify or create sequence files. You cannot modify the sequence editor because the source code is not provided. Because the source code for the operator interface installs with TestStand, you can modify the code and create a customized operator interface for every user. 17. Browse to Exercise Folder and double click Custom OI.exe to open the operator interface. 18. After the LabVIEW Operator Interface loads, the Login dialog box displays. Select the default, administrator, from the User Name control and leave the Password text box empty. 19. Click OK in the Login dialog box. 20. The Sequence File window opens in the operator interface. Select Open Sequence File and open the Final Handheld Test.seq file from the Exercises folder. Figure 1 shows the sequence file displayed in the operator interface. 21. Click Single Pass to execute the sequence. Figure 1 LabVIEW Operator Interface
23 22. The Sequence File and Execution windows are separate views of the same program in the operator interface. The Sequence File window displays all information related to the sequence file(s) currently loaded into memory including the sequence filename, the current logged in user, and the steps in the sequence. The Execution window displays all the information related to the execution of a sequence file including the status of each step in the sequence file, which sequence is running, and the sequence report contents. Click the name of either view in the left pane of the operator interface to bring it to the front and display its contents. 23. Click the Report tab in the Execution window to display the report. 24. Select Close Execution. 25. Select Exit to close the operator interface. Figure 2 Operator Interface Report End of Exercise 5