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.

The LabVIEW Unit Test Framework Toolkit provides test vectors you use to manage multiple input or expected values. 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 the Test Vector Properties - Edit dialog box.
    • Using the front panel of a VI.
    • Using third-party text editors.

    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.
    Note

    LabVIEW automatically gathers and displays measurements when you create a test.

    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.

    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.