Download Help (Windows Only) |
The LabVIEW Unit Test Framework Toolkit provides several comparison types you use to compare resulting values with expected values. When you configure a test case, you specify a comparison type for each Output Name on the Test Cases page of the Test Properties dialog box. LabVIEW lists the available comparison types that each data type supports. You also can specify a user-defined comparison VI.
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.
The following figure shows an example of specifying the comparison type for an output terminal.
In the previous figure, LabVIEW lists the available comparison types you can use to compare the resulting value of the x*y terminal with the expected value.
Creating a User-Defined Comparison VI
The following table lists comparison types that the Unit Test Framework Toolkit supports.
Comparison Type | Description |
---|---|
= | Resulting value equals the expected value. |
= (elm) | Resulting array elements equal the expected array elements. |
!= | Resulting value does not equal the expected value. |
!= (elm) | Resulting array elements does not equal the expected array elements. |
> | Resulting value is greater than the expected value. |
>= | Resulting value is greater than or equal to the expected value. |
< | Resulting value is less than the expected value. |
<= | Resulting value is less than or equal to the expected value. |
vector length | Resulting complex vector length equals the expected complex vector length. |
range | Resulting value is within a given range, a and b, where a ≤ expected value ≤ b. |
symmetric tolerance | Resulting value is within a symmetric tolerance, a and b, where a – b ≤expected value ≤ a + b. |
asymmetric tolerance | Resulting value is within an asymmetric tolerance, a, b, and c where a – b ≤ expected value ≤ a + c. |
string length | Resulting string length equals the expected value. |
string contains | Resulting string contains the substring. |
string not contain | Resulting string does not contain the substring. |
array size | Resulting array size for each dimension equals the expected value. |
array contains | Resulting array contains the element. |
array not contain | Resulting array does not contain the element. |
array range | All elements of the resulting array are within a given range, a and b, where a ≤ expected values ≤ b. |
array range (limit array) | All elements of the resulting array are within the range of the array limit, A[n], and drift, b, where A[n] – b ≤ expected value ≤ A[n] + b. |
by element | Applies to clusters and arrays only. Allows you to assign different comparison types for each element of an array or a cluster. |
user-defined | Allows you to use a user-defined comparison VI to compare the resulting value with the expected value. |
Note LabVIEW uses the Digits of precision for floating-point comparison you specified on the Advanced page of the Test Properties dialog box to compare the resulting floating-point values with expected floating-point values. |
Refer to the labview\examples\Unit Test Framework\User-Defined Comparison\User-Defined Comparison.lvproj for an example that demonstrates how to use user-defined comparison VIs in the Unit Test Framework Toolkit.
Helpful
Not Helpful