LabVIEW 2009 Unit Test Framework Toolkit Help
Edition Date: June 2009
Part Number: 372584B-01
»View Product Info
Use the Unit Test Framework VIs to execute tests programmatically.
Executing Tests from .lvtest Files
Complete the following steps to create a VI that executes tests from .lvtest files programmatically.
- Select File»New VI to create a new, blank VI.
- Display the block diagram by selecting Window»Show Block Diagram.
- If you do not see the Functions palette, select View»Functions Palette to display this palette.
- On this palette, select Programming»Unit Test Framework to display the Unit Test Framework VIs.
- Add the Run Tests from File VI to the block diagram.
- Add the Open Results Window VI to the block diagram.
- Wire the test results out output of the Run Tests from File VI to the test results in input of the Open Results Window VI.
- Right-click the test file paths input of the Run Tests from File VI and select Create»Control from the shortcut menu.
A front panel control appears to the left of this VI. This control represents an array of paths to the .lvtest files that you want to execute.
-
Wire all error in and error out terminals on the block diagram.
- Display the front panel and click the Browse button on the test file paths control to select a .lvtest file.
- (Optional) Move the cursor over the test file paths control. When a double-headed arrow appears, click and drag the border of the control to add more elements to the array of paths. You also can use the numeric control to display subsequent array elements. Add additional .lvtest files that you want to execute.
- Select File»Save As and save this VI in an easily accessible location.
- Click the Run button to run the VI.
 |
Note When you execute tests from .lvtest files programmatically, LabVIEW executes tests in the order as they listed in the test file paths control. |
Refer to the labview\examples\Unit Test Framework\Programmatic Tests\Run Tests from File.vi for an example that demonstrates how to use the Run Tests from File VI to execute tests programmatically.
Executing Tests from a Project
Complete the following steps to create a VI that executes tests from a project programmatically.
- Select File»New VI to create a new, blank VI.
- Add the Run Tests from Project VI to the block diagram.
- Add the Open Results Window VI to the block diagram.
- Wire the test results out output of the Run Tests from Project VI to the test results in input of the Open Results Window VI.
- Right-click the project file path input of the Run Tests from Project VI and select Create»Control from the shortcut menu.
A front panel control appears to the left of this VI. This control represents the path to the project file (.lvproj) that you want to execute tests.
-
Wire all error in and error out terminals on the block diagram.
- Display the front panel and click the Browse button on the project file path control to select a project file.
- Select File»Save As and save this VI in an easily accessible location.
- Click the Run button to run the VI.
 |
Note When you execute tests from a project programmatically, LabVIEW executes tests in the order as they are listed in the project. |
Refer to the labview\examples\Unit Test Framework\Programmatic Tests\Run Tests from Project.vi for an example that demonstrates how to use the Run Tests from Project VI to execute tests programmatically.
Generating a Test Report
Complete the following steps to generate a test report when you execute tests programmatically.
- Open a VI that executes tests programmatically.
- Add the Create Report VI to the block diagram.
- Wire the test results out output of the Open Results Window VI to the test results in input of the Create Report VI.
 |
Note You also can wire the test results out output of the Open Results Window VI to the test results in input of the Run Tests from Project or Run Tests from Files VI. |
- Right-click the report type input of the Create Report VI and select Create»Control from the shortcut menu.
A front panel control appears to the left of this VI. This control represents the type of report that this VI generates after test execution.
- Click the report type control and select the type of report this VI generates. The default report type is HTML.
- Right-click the report path input of the Create Report VI and select Create»Control from the shortcut menu.
A front panel control appears to the left of this VI. This control represents the path to which this VI generates the test report.
- Click the report path control and select the path to which this VI generates the test report.
 |
Note If you do not select a path for the report, LabVIEW generates the report in the My Documents\LabVIEW Data directory. |
-
Wire all error in and error out terminals on the block diagram.
The block diagram now resembles the following figure.

 |
Note You can customize the test report by wiring values to the remaining inputs of the Create Report VI. |
- Select File»Save As and save this VI in an easily accessible location.
- Click the Run button to run the VI.