Company Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Configuring Test Cases (Unit Test Framework Toolkit)

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.

Note  LabVIEW lists the controls and indicators from the VI under test on the Test Cases page. If the Input/output values setting on the Unit Test: Test Creation page of the Project Properties dialog box is Include controls and indicators from connector pane, make sure you select a connector pane pattern and assign the terminals for the VI under test.

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.
  1. Open the LabVIEW project that contains the files on which you want to perform unit testing.
  2. 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.
  3. Select Test Cases from the Category list to display the Test Cases page.
  4. If this test has more than one test case, use the Test Case control to select the test case you want to configure.
  5. 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.
  6. 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.
  7. 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.
  8. (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.
  9. Click the OK button to close the dialog box and return to the Project Explorer window.
  10. 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.

  1. Open the LabVIEW project that contains the files on which you want to perform unit testing.
  2. 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.
  3. Select Test Cases from the Category list to display the Test Cases page.
  4. If this test has more than one test case, use the Test Case control to select the test case you want to configure.
  5. 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.
  6. 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.
  7. 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.
  8. Select a comparison type from the Comparison list of the output terminal you want to configure. Repeat this step for other output terminals.
  9. Click the OK button to close the dialog box and return to the Project Explorer window.
  10. 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.


 

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit