This document was originally published at the Delacor blog
Background
We were working with Stefan Lemmens to update the custom Delacor VI Analyzer Tests for his company. They have some projects that use LabVIEW versions that are earlier than LabVIEW 2018 and some projects that use LabVIEW 2018. They wanted to take advantage of the #via_ignore feature when using LabVIEW 2018 and we didn't want to maintain two packages. Stefan came up with an idea on how to do this and at Delacor we expanded it. We thought this was too good to keep to ourselves and we hope it helps others trying to solve the same issue.
Types of VI Analyzer Tests
There are two types of VI Analyzer tests:
All VI Analyzer tests created in LabVIEW 2018 or later are UID tests. You can also manually convert an RD test to a UID test by (1) Modifying the test's scripting code to pass UIDs instead of traversal indices, and (2) deleting the RD VI from the test LLB.
VI Analyzer 2018 and later will load and run either type of test. Unfortunately, in order to utilize the #via_ignore functionality added in VI Analyzer 2018, a test must be a UID test. So if you have old RD tests you are still using, they will not support the ability to ignore individual test results.
Implementing Dual Version VI Analyzer Tests
There is a workaround for this situation. You can implement your VI Analyzer test as a Dual Version VI Analyzer test by following these steps:
This code will return a Boolean that specifies whether or not the test that is currently running is an RD test or a UID test. Note that the code in the case structure only runs the first time it is called. It will use the stored value on each subsequent call (during an analysis session). This results in a minimal performance hit.
2. In the scripting code of your VI Analyzer test, generate both the traversal index (for an RD test) and the UID (for a UID test), and conditionally pass the proper value, depending on the Boolean value returned by the code snippet above. Here is an example:
The RD VI for this test specifies "Wire" as the failure object. If the test is an RD test (based on the code snippet described above), return the loop index in the failure cluster. If the test is a UID test, return the UID of the Wire.
3. When installing the VI Analyzer test, conditionally delete the RD VI from the test LLB if the test is being installed to LabVIEW 2018 or later. If you are using VIPM to distribute your VI Analyzer tests, this can be easily accomplished with a Post Install Action VI that queries the LabVIEW install version and conditionally modifies the test LLBs post-install.
Using this approach allows you to single-source your VI Analyzer test development in the earliest LabVIEW version you wish to support, while also giving you the valuable #via_ignore functionality provided in LabVIEW 2018 and later.
Caveat
When using the dual version test technique, you will probably want to install your tests to the LabVIEW folder. Tests in the LabVIEW Data folder will be shared across LabVIEW versions, and for the next several years anyway, if you are in a company like Stefan's, chances are you'll be using these tests in a LabVIEW version prior to 2018.
At Delacor we have helped customers create and maintain their custom VI Analyzer tests to guide their team through LabVIEW Style guidelines compliance. Let us know if we can help you do the same.
Happy wiring,