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

Executing Tests Programmatically (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)

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.

  1. Select File»New VI to create a new, blank VI.
  2. Display the block diagram by selecting Window»Show Block Diagram.
  3. If you do not see the Functions palette, select View»Functions Palette to display this palette.
  4. On this palette, select Programming»Unit Test Framework to display the Unit Test Framework VIs.
  5. Add the Run Tests from File VI to the block diagram.  

  6. Add the Open Results Window VI to the block diagram.  

  7. 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.
  8. 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.
  9. Wire all error in and error out terminals on the block diagram.
  10. Display the front panel and click the Browse button on the test file paths control to select a .lvtest file.
  11. (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.
  12. Select File»Save As and save this VI in an easily accessible location.
  13. 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 Programmatically Run Tests from File VI in the labview\examples\Unit Test Framework\Programmatic Tests directory for an example that demonstrates how to use the Run Tests from File VI to execute tests programmatically.

Related Information

Setting up Error I/O in a VI

Executing Tests from a Project

Complete the following steps to create a VI that executes tests from a project programmatically.

  1. Select File»New VI to create a new, blank VI.
  2. Add the Run Tests from Project VI to the block diagram.  

  3. Add the Open Results Window VI to the block diagram.  

  4. 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.
  5. 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.
  6. Wire all error in and error out terminals on the block diagram.
  7. Display the front panel and click the Browse button on the project file path control to select a project file.
  8. Select File»Save As and save this VI in an easily accessible location.
  9. 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 Programmatically Run Tests from Project VI in the labview\examples\Unit Test Framework\Programmatic Tests for an example that demonstrates how to use the Run Tests from Project VI to execute tests programmatically.

Related Information

Setting up Error I/O in a VI

Generating a Test Report

Complete the following steps to generate a test report when you execute tests programmatically.

  1. Open a VI that executes tests programmatically.
  2. Add the Create Report VI to the block diagram.  

  3. 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.
  4. 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.
  5. Click the report type control and select the type of report this VI generates. The default report type is HTML.
  6. 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.
  7. 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.
  8. 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.
  9. Select File»Save As and save this VI in an easily accessible location.
  10. Click the Run button to run the VI.

Related Information

Test Results

Setting up Error I/O in a VI


 

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