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 NI website 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.

To change the test description, revise the description of the test Config.vi.

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. Use the VIAnUtil Build Result Cluster VI to specify a test result message and the UID property of the object that failed. This utility VI returns the Results Data array.
    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 the main test VI, use the Traverse for GObjects VI to obtain references to the objects that can fail a test. In the Traverse Target input, select one of the following items from the shortcut menu.
    0 FP—Specifies that the Class Name input is a class of object that can exist on the front panel.
    1 BD—Specifies that the Class Name input is a class of object that can exist on the block diagram.
    2 Other—Specifies to search only the container object wired to the Other Refnum input for the class of object specified by the Class Name input.
  2. Use the References output of the Traverse for GObjects VI in a loop structure to read the UID property of the objects, along with any other properties necessary to perform the test.
  3. Pass the value of the UID property as the Ref Index for any test failures you add to the Results Data array.

Changing the Test Ranking of a Custom Test

The VI Analyzer Test Creator wizard allows you to specify the test ranking when you create a new test. To change the test ranking after you create a test, complete the following steps.

  1. Open the test configuration VI.
  2. Determine whether the configuration page is global VI-based or VI-based. For example, select File and identify the presence of the Global Properties or VI Properties menu item, which indicates that the configuration page is global VI-based or VI-based, respectively.
  3. Show the hidden Test Ranking control.
  4. Change the value of the Test Ranking control.
  5. Right-click the control and select Data Operations�Make Current Value Default from the shortcut menu to make the current value the default value.
  6. Hide the Test Ranking control and any other front panel objects you want to hide by right-clicking the object and selecting Advanced�Hide Control.
  7. Save the test configuration VI.

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.