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

Tests and .lvtest Files (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)

The LabVIEW Unit Test Framework Toolkit provides tools you use to create tests to check VIs for functional correctness. When you create a test from the Project Explorer window, LabVIEW creates a .lvtest file on disk. A .lvtesticon appears on both the Items and Files pages.

Each .lvtest file contains the settings LabVIEW uses to check the VI under test for functional correctness. When you execute a test, LabVIEW runs the 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 by using the comparison types you specified.

Note  By default, LabVIEW saves the .lvtest file in the same directory as the VI under test. You can specify a different Default location file path on the Unit Test Framework page of the Project Properties dialog box.

Use the Project Explorer window to configure tests interactively. You also can configure tests by editing .lvtest files.

Related Information

Creating Tests

Tests and .lvtest Files

Test File Format

You can view and edit .lvtest files by using Microsoft Excel or a text editor.

Note  If you use Microsoft Excel to edit a .lvtest file, you must save the file using Unicode Text (.txt) file format. When you save a .lvtest file, Microsoft Excel modifies formatting that is not compatible with tab-delimited text. For example, if a cell contains a comma, Microsoft Excel uses double quotation marks to enclose the cell contents. This conversion might result in an unexpected error in the .lvtest file. Refer to the Microsoft Excel documentation for more information about formatting that is not compatible with tab-delimited text.

The following table contains information about each component of a .lvtest file, including descriptions, default values, and notes. When you edit a .lvtest file, the file must include components that LabVIEW uses to read and execute a test.

Caution  Do not remove any lines or components from a .lvtest file. If you remove anything, the test might not execute properly.
Component Description Default Value Notes
LabVIEW Unit Test Framework Header information that LabVIEW uses to identify tests that you created by using the Unit Test Framework Toolkit. N/A Do not modify.
Version Header information that LabVIEW uses to identify the version of the Unit Test Framework Toolkit the test was created in. Automatic† Do not modify.
VI under Test Specifies the path to the VI under test. If the .lvtest file is located in the same directory as the VI under test, LabVIEW displays only the name of the VI without the path. Automatic† If the .lvtest file is located in the same drive as the VI under test, use the relative path. Otherwise, use the absolute path. You can specify only one VI under test for each .lvtest file.
Library Specifies the path to the LabVIEW class library (.lvclass) or the LabVIEW project library (.lvlib) the test vector file belongs to, if any. Automatic† If the .lvtest file is located in the same drive as the library, use the relative path. Otherwise, use the absolute path.
Comment Specifies comments about the test. N/A Comment cannot contain line breaks.
Priority Specifies priority of the test. This priority determines whether LabVIEW executes the test when you execute tests by priority. 5 The highest priority is 1000, and the lowest priority is 0.
Requirement ID Specifies requirement IDs for integration with NI Requirements Gateway. Optional N/A
Skip Test (Project Explorer Window) Specifies whether to skip the test when you execute tests interactively from the Project Explorer window. NO YES/NO
Skip Test (Unit Test Framework VIs) Specifies whether to skip the test when you execute tests programmatically by using the Unit Test Framework VIs. NO YES/NO
Decimal Separator Specifies the character LabVIEW uses to separate the integral and fractional parts of a decimal number. . Valid decimal separators: . ,
Set Timeout Specifies whether to set a timeout when executing the test. NO YES/NO
Timeout Specifies the time limit, in seconds, in which LabVIEW must complete the test execution. 0 Use a numeric value.
This value is valid only when Set Timeout is set to YES.
Check Code Coverage Specifies whether to set a minimum code coverage requirement when executing the test. NO YES/NO
Minimum Code Coverage Specifies the percentage of subdiagrams LabVIEW must execute during test execution. 100 Valid minimum code coverage: 0-100.
This number is valid only when Check Code Coverage is set to YES.
User-Defined Test Specifies whether to use a user-defined test VI to execute the test. NO YES/NO
User-Defined Test VI Path Specifies the path to the user-defined test VI. N/A This path is valid only when User-Defined Test is set to YES.
Name Separator Specifies the character LabVIEW uses to separate control and indicator names of a cluster. / Valid name separators: / \ | : ` ~ ! @ # $ % ^ & * - _ = + ' " : ; ?
Array Brackets Specifies the characters LabVIEW uses to wrap control and indicator names of an array. [] Valid array brackets: () [] {} <>
Repetitions Specifies the number of times to repeat a test. 1 Use a numeric value.
Digits of Precision Specifies the number of digits after the decimal separator LabVIEW uses to compare floating-point values. 6 Valid digits of precision: 0-32
Input/Output Values Specifies which controls and indicators of the VI under test appear on the Test Cases page of the Test Properties dialog box. Include controls and indicators from connector pane Available Options:
- Include controls and indicators from connector pane
- Include controls and indicators from front panel
- Include controls and indicators from front panel as both input and output
Maximum Array Elements Specifies the maximum number of array elements that LabVIEW lists on the Test Cases page of the Test Properties dialog box. If an array contains more elements than the specified number, LabVIEW lists the array as one item. 100 Use a numeric value.
Save Control Names in Normal Format Specifies whether to save control names in normal format. If a control name contains non-printable control characters used for text formatting, which are the first 32 codes (from 0 to 31) in the ASCII code table, LabVIEW displays NO. Otherwise, LabVIEW displays YES. Automatic† Do not modify.
Capture Input Values Specifies whether to capture the default input values from the VI under test when creating a test. YES N/A
Capture Output Values Specifies whether to capture the default output values from the VI under test when creating a test. YES N/A
Set Automatic Error Handling Specifies whether to automatically handle errors for the VI under test during test execution. As is Available options:
- As is
- Enable automatic error handling
- Disable automatic error handling
Remove Breakpoints Specifies whether to toggle test execution suspension at a breakpoint. YES YES/NO
Test Case Name Lists the name of each test case. 1 Use a numeric value or a user-defined name. Test Case Name cannot contain components of a.lvtestfile.
Test Case Comment Specifies comments about the test case. N/A Test Case Comment cannot contain line breaks.
Test Case Lists the name of each test case. Automatic† N/A
VI Specifies the type of VI which contains the terminals to configure a test case. N/A Valid VI types:
- VI under Test
- Setup VI
- Teardown VI
In/Out Specifies whether LabVIEW uses each terminal as an input or output. Default for controls is IN.
Default for indicators is OUT.
IN/OUT
Set/Check Specifies whether each terminal sets, checks, or ignores the input or expected value. Default for controls is SET.
Default for indicators is CHECK.
SET/CHECK/IGNORE
Control Name Specifies the name of each terminal. Automatic† Name must match the terminals on the VI under test.
If the terminal is an array, the number in square brackets ([ ]) indicates the index of a specific array element. The index is zero-based, which means it is in the range of 0 to n-1, where n is the number of elements in the array or cluster. For example, Array[0] refers to the first element of the array.
If the terminal is a cluster, LabVIEW uses a forward slash (/) to separate control and indicator names.
You can change the default array brackets and name separator on the Unit Test Framework page of the Project Properties dialog box.
Data Type Specifies the data type of each terminal. Automatic† N/A
Value Specifies the input or expected value of each terminal. Automatic† N/A
Comparison Specifies the comparison type LabVIEW uses to compare the resulting value with the expected value. = Supported comparison types.
Comparison VI Path Specifies the path to the user-defined comparison VI. N/A N/A
Vector Name Specifies the name of test vector assigned to each terminal N/A N/A
Setup VI Path Specifies the path to the setup VI. N/A N/A
Output of Setup VI Specifies the output terminals of the setup VI that LabVIEW uses to pass values from the setup VI to the VI under test. N/A N/A
Input of VI under Test Specifies the input terminals of the VI under test that LabVIEW uses to retrieve values from the setup VI. N/A N/A
Teardown VI Path Specifies the path to the teardown VI. N/A N/A
Input of Teardown VI Specifies the input terminals of the teardown VI that LabVIEW uses to retrieve values from the VI under test. N/A N/A
Output of VI under Test Specifies the output terminals of the VI under test that LabVIEW uses to pass values from the VI under test to the teardown VI. N/A N/A
Included Vector Files Specifies the test vector files that a test contains. N/A If the test vector file is located in the same folder as the VI under test, list the test vector file name. Otherwise, use the relative path.
Notes:
† LabVIEW gathers and displays this information when you create the test.

Related Information

Code Coverage

Creating Projects and Tests

Executing Tests

Requirement IDs

Setup and Teardown VIs

Example of a .lvtest File

The following figure shows an example of a .lvtest file.


 

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