LabVIEW 2009 Unit Test Framework Toolkit Help
Edition Date: June 2009
Part Number: 372584B-01
»View Product Info
Use the
Test Cases page of the
Test Properties dialog box to configure test cases interactively. You also can configure test cases by exchanging values between the VI under test, setup VI, teardown VI, and the Test Cases page.
Entering Input Values, Expected Values, and Comparison Types
Complete the following steps to enter the input values, expected values, and comparison types for a test case.
 |
Tip You can resize the Test Properties dialog box and table columns to fit the input and output data in the table. |
-
Open the LabVIEW project that contains the files on which you want to perform unit testing.
-
Right-click a .lvtest file and select Properties from the shortcut menu to display the
Test Properties dialog box. You also can double-click the .lvtest file to open the dialog box.
-
Select Test Cases from the Category list to display the Test Cases page.
-
If this test has more than one test case, use the Test Case control to select the test case you want to configure.
- Click the Input Value text box of the input terminal you want to configure and enter a value. Repeat this step for other input terminals.
 |
Tip You also can exchange values between the VI under test, setup VI, teardown VI, and the Test Cases page. |
- Click the Expected Value text box of the output terminal you want to configure and enter a value. Repeat this step for other output terminals.
-
Select a comparison type from the Comparison list of the output terminal you want to configure. Repeat this step for other output terminals.
 |
Note LabVIEW lists the available comparison types that each data type supports. You also can use a user-defined comparison VI by selecting custom from the Comparison list and selecting a user-defined comparison VI. |
- (Optional) Remove the checkmark from each input or output terminal that you do not want to test during execution.
 |
Tip You can select multiple entries by pressing the <Ctrl> key while clicking each entry. Then right-click the selection and select Uncheck All Selected or Check All Selected. |
-
Click the OK button to close the dialog box and return to the Project Explorer window.
-
Select File»Save to save the project.
Exchanging Values Between the VI Under Test, Setup VI, Teardown VI, and the Test Cases Page
You can modify the input and expected values by using the front panel of the VI under test, setup VI, and teardown VI and then importing these values to a test case. You also can export values from a test case to the VI under test, setup VI, and teardown VI.
Complete the following steps to exchange values between the VI under test, setup VI, teardown VI, and the Test Cases page.
-
Open the LabVIEW project that contains the files on which you want to perform unit testing.
-
Right-click a .lvtest file and select Properties from the shortcut menu to display the
Test Properties dialog box. You also can double-click the .lvtest file to open the dialog box.
-
Select Test Cases from the Category list to display the Test Cases page.
-
If this test has more than one test case, use the Test Case control to select the test case you want to configure.
- Click the Export Values to VI button to export the input and expected values from the current test case to the VI under test, setup VI, and teardown VI. The VI under test, setup VI, and teardown VI open in a separate window.
 |
Tip Use the Export Values to VI button to open the VI under test while configuring a test. |
- From the front panel of the VI under test, setup VI, and teardown VI, modify the values of any controls and indicators you want to configure.
- On the Test Properties dialog box, click the Import Values from VI button to import values from the VI under test, setup VI, and teardown VI to the current test case.
 |
Note When you import values from the VI under test, setup VI, and teardown VI, LabVIEW replaces the input and expected values of the current test case with the values of the corresponding terminals in the VI under test, setup VI, and teardown VI. |
-
Select a comparison type from the Comparison list of the output terminal you want to configure. Repeat this step for other output terminals.
-
Click the OK button to close the dialog box and return to the Project Explorer window.
-
Select File»Save to save the project.
The next time you execute this test, LabVIEW runs the setup VI and VI under test by using the input values you specified for each test case in the .lvtest file. LabVIEW then compares the resulting values with the expected values of the VI under test and teardown VI by using the comparison types you specified.