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

Test Vectors and .lvvect 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 test vectors you use to manage multiple input or expected values. A test vector is an array of input or expected values that you can assign to an input or output of the VI under test. You can use test vectors to assign multiple values to an input or output of the VI under test in a test case.

Before you create a test vector, you must create a test vector file in a LabVIEW project. A test vector file is a text file that contains one or multiple test vectors. When you create a test vector file in the Project Explorer window, LabVIEW creates a .lvvect file on the disk. A .lvvect icon appears on both the Items and Files pages.

Note  By default, LabVIEW saves the .lvvect 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.

The Unit Test Framework Toolkit provides the following two types of test vectors:

  • Sequence—This type of test vector lists all the values sequentially. For example, you can create a sequence test vector that contains the following values: (1, 2, 6, 92, 15). The data type of a sequence test vector can be either numeric or non-numeric.
  • Linear—This type of test vector uses the following three elements to describe an array of numeric values that have linear relationship.
    • First element—Specifies the start value of the linear test vector.
    • Second element—Specifies the increment step value of the linear test vector.
    • Third element—Specifies the value numbers of the linear test vector.
    For example, if you create a linear test vector (1, 2, 4), LabVIEW reads this test vector as an array that contains the following values: (1, 3, 5, 7). You cannot create a linear test vector for non-numeric values, such as strings, Boolean values, or paths.

You can edit test vectors by using the following methods:

Using Test Vector Indexes

In the Test Cases page, you can assign test vectors to each input or output of a VI to test this VI with multiple input or expected values in one test case. After you assign test vectors to inputs of the VI under test, LabVIEW generates permutations for the input values. After you assign test vectors to outputs of the VI under test, LabVIEW compares the number of the input permutations and the size of the test vector assigned to the output terminal in the following methods:

  • When the number of the input permutations is equal to the size of the test vector assigned to the output terminal, LabVIEW executes the test by comparing the resulting values with the expected values in the test vector.
  • When the number of the input permutations is smaller than the size of the test vector assigned to the output terminal, LabVIEW executes the test and the Test Cases page displays a warning icon.
  • When the number of the input permutations is larger than the size of the test vector assigned to the output terminal, LabVIEW reports an error and does not execute the test.

You can use test vector indexes to configure the numbers of input value permutations. LabVIEW does not set indexes to test vector by default. If the assigned test vectors have no or different indexes, LabVIEW generates all possible permutations of the input values. For example, you create two sequence test vectors, (3, 4, 5) and (1, 2). You then assign these test vectors to the x and y controls of the following VI with no or different indexes.

When you execute this test, LabVIEW tests this VI for six times with the following x and y values:

  • x=3 y=1
  • x=3 y=2
  • x=4 y=1
  • x=4 y=2
  • x=5 y=1
  • x=5 y=2

If the assigned test vectors have identical indexes, LabVIEW sends the test vector values to the inputs one by one and stops the test when any test vector reaches the end. For example, you can assign two test vectors, (3, 4, 5) and (1, 2), to the x and y controls of the previous VI and set the indexes of these test vectors to index 1. When you execute this test, LabVIEW tests this VI for twice with the following x and y values:

  • x=3 y=1
  • x=4 y=2

Related Information

Assigning Test Vectors in Test Cases

Test Vector File Format

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

Note  If you use Microsoft Excel to edit a .lvvect file, you must save the file using Unicode Text (.txt) file format. When you save a .lvvect 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 .lvvect 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 .lvvect file, including descriptions, default values, and notes.

Component Description Default Value Notes
LabVIEW Unit Test Framework Header information that LabVIEW uses to identify test vectors 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 vector file was created in. Automatic† Do not modify.
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 .lvvect file is located in the same drive as the library, use the relative path. Otherwise, use the absolute path.
Namespace Specifies the name of the LabVIEW class library (.lvclass) or the LabVIEW project library (.lvlib) that the test vector file belongs to, if any. Automatic† N/A
Include Lists the test vector files that this test vector file includes. You can use these test vector files in a test. Optional N/A
Test Vector Lists test vectors that belong to this test vector file. If you open this test vector file in Microsoft Excel, each column in this section indicates a test vector. N/A Refer to the table below for detailed information about each component of a test vector.
Notes:
† LabVIEW gathers and displays this information when you create the test vector.

The following table contains information about each sub-component of a test vector in the Test Vector component of a test vector file.

Row Number Component Description Default Value Note
1 Name Specifies the name of a test vector. <Blank> N/A
2 Data Type Specifies the data type of a test vector. <Blank> A test vector supports the following data types: I8, I16, I32, I64, U8, U16, U32, U64, Single Float, Double Float, Extended Float, Single Complex, Double Complex, Extended Complex, Enum U8, Enum U16, Enum U32, Enum U64, Boolean, String, Path. A test vector does not support the Array or Cluster data type but you can assign test vectors to elements of array or cluster controls of the VI under test or the setup VI on the Test Cases page of the Test Properties dialog box.
3 Append to Specifies another test vector. LabVIEW adds the values of the specified test vector to the beginning of the current test vector, and moves the original values of the current test vector after these new values. <Blank> N/A
4 Requirement ID Specifies the requirements ID of this test vector to use this test vector with NI Requirements Gateway. <Blank> N/A
5 Edit Type Specifies the type of the test vector. Sequence N/A
6 Value Start Indicates the beginning point of the test vector values. Value Start Do not modify.
7 and Greater Values Specifies values of this test vector. <Blank> Each row between the Value Start row and the Value End row indicates a test vector value.
Last Value End Specifies the ending point of the test vector values. Value End You can insert rows above this row to add new test vector values.

Related Information

Assigning Test Vectors in Test Cases

Test Vectors and .lvvect Files

Example of a .lvvect File

The following figure shows an example of a test vector file.

You can add, edit, and remove test vectors by editing this test vector file in Microsoft Excel or a text editor.


 

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