Company Events Academic Community Support Solutions Products & Services Contact NI MyNI

Setup and Teardown VIs (Unit Test Framework Toolkit)

LabVIEW 2013 Unit Test Framework Toolkit Help

Edition Date: June 2013

Part Number: 372584F-01

»View Product Info
Download Help (Windows Only)

During unit testing, you might want to perform tasks before and after checking a VI for functional correctness. For example, you might want to power up an instrument, open a file, or pass values from another VI to the VI under test. After LabVIEW finishes checking the VI under test for functional correctness, you might want to pass values from the VI under test to another VI, close a file, or power down an instrument.

A setup VI is a VI that LabVIEW runs before checking the VI under test for functional correctness. A teardown VI is a VI that LabVIEW runs after checking the VI under test for functional correctness. The LabVIEW Unit Test Framework Toolkit provides tools you use to configure a test to run setup and teardown VIs. You also can pass values among the setup VI, the VI under test, and the teardown VI.

You can configure tests to run setup and teardown VIs by using the Setup/Teardown page of the Test Properties dialog box. You also can specify setup and teardown VIs by editing .lvtest files. Use the Test Cases page to specify the input values, expected values, and comparison types of the setup and teardown VIs for each test case.

When you execute a test, LabVIEW first runs the setup VI and then passes the output values from the setup VI to the inputs of the VI under test. LabVIEW then checks the VI under test for functional correctness and passes the resulting values from the VI under test to the inputs of the teardown VI.

The following figure shows an example of configuring the setup and teardown VIs for a test.

The previous figure shows the configurations for running the setup and teardown VIs during test execution. When you execute this test, LabVIEW runs the setup VI and passes the values from the refnum out and error out terminals of the setup VI to the refnum and error in terminals of the VI under test. LabVIEW then runs the VI under test by using the values from the setup VI as input values. For input values that are not passed from the setup VI, such as the text input in this example, LabVIEW uses the input values from the Test Cases page. After checking the VI under test for functional correctness, LabVIEW passes the values from the refnum out and error out terminals to the corresponding inputs of the teardown VI.

Note  If the teardown VI has an error out output and the output contains an error, LabVIEW shows this test on the Test Errors page of the Unit Test Framework Results window instead of on the Test Results page.

Refer to the labview\examples\Unit Test Framework\Setup Teardown\Setup Teardown.lvproj for an example that demonstrates how to use setup and teardown VIs.

Related Information

Configuring Tests to Run Setup and Teardown VIs


 

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