Designing a Custom VI Analyzer Test (VI Analyzer Toolkit)

Note  The VI Analyzer functionality this topic describes is available only if you install and activate the LabVIEW VI Analyzer Toolkit. Refer to the National Instruments Web site for more information about the VI Analyzer Toolkit.

Select Tools»VI Analyzer»Create New Test to display the VI Analyzer Test Creator wizard. Complete each page of the wizard to generate template files for a custom test. A VI Analyzer test consists of an LLB of files that perform the following tasks when you run the test:

The VI Analyzer Test Creator wizard saves test LLBs you create in the LabVIEW Data\VI Analyzer Tests directory. Before you can run the test in the VI Analyzer, you must modify each file in the test LLB. Refer to the following sections of this topic to modify each file so you can run the test.

Creating a Test Configuration Page

In test Config.vi, add any front panel controls you want to appear on the test configuration page and configure the controls if needed. To set a default value for a control, right-click the control and select Data Operations»Make Current Value Default from the shortcut menu. If the configuration page is VI-based, add code to the block diagram that controls the user interface as you interact with it.

Tip  Use the system controls and indicators to create a configuration page that changes appearance depending on which platform you run the VI Analyzer.

After you add controls to the configuration page, delete the existing decoration and text from the front panel. Even if the test does not require configuration values, you still must delete these items.

Writing the Test

In the main VI in the LLB, complete the following steps to work with the template controls and indicators in the test VI.

  1. Use the VI Refnum input to obtain a reference to the VI you want to test. Use VI server properties and methods to obtain references to objects in the VI. To find all instances of a particular object in a VI, whether on the front panel, block diagram, or in containers such as tab controls, you can use the reference with the Traverse for GObjects VI. You must enable VI Scripting before you can use the Traverse for GObjects VI.
  2. (Optional) In the upper right corner of the configuration page global VI, click and drag the icon to the block diagram of the test VI to create a global variable you can use to access values from the configuration page.
  3. Add code to bundle a failure message string and the numeric index of the object that failed into a cluster wired to the Results Data array. If the test checks properties of a front panel or block diagram rather than a VI object, bundle an index of 0 with a failure message.
    Note  Do not add data to the Results Data array when a test passes.

Refer to the following guidelines as you add test code to the block diagram:

Configuring the Test to Highlight Failures

After you run a test in the VI Analyzer, you can double-click a failure in the VI Analyzer Results Window to open the VI that failed the test and display the object that caused the failure. Complete the following steps to allow the VI Analyzer to perform this task for custom tests you create.

  1. In test RD.vi, click the Traverse Target control and select one of the following items from the shortcut menu.
    0 FP—Specifies that front panel objects can fail the test.
    1 BD—Specifies that block diagram objects can fail the test.
    2 Other—Specifies that front panels, block diagrams, or groups of specific objects can fail the test.
  2. Enter the class name of an object that can cause the test to fail in the Class string control. For example, if the test checks enumerated type controls, enter Enum in the string control.
  3. Repeat steps 1 and 2 in subsequent elements of the Reconstruct Array for additional classes that can cause failures.
  4. Right-click the array shell and select Data Operations»Make Current Value Default from the shortcut menu to save these settings.

Other Ways to Highlight Failures

When the value of Traverse Target is Other, you can specify the following strings in the Class string control to configure the VI Analyzer to highlight parts of VIs and groups of specific objects:

Running and Distributing Custom Tests

After you modify each file in the test LLB, you can run the test in the VI Analyzer. The VI Analyzer lists custom tests in the <User-Specified> category.

You can run custom tests on other computers with the LabVIEW development system installed. Copy custom test LLBs from the LabVIEW Data\VI Analyzer Tests directory on the development computer to the corresponding location on other computers to allow the VI Analyzer to run the test on the other computers. LabVIEW returns an error if you run a test in an earlier version of LabVIEW than the version in which you created and saved the custom test.