From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Example Code

Passing Custom Command Line Arguments to a TestStand Operator Interface (CVI)

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • Teststand

Code and Documents

Attachment

Description

Overview

The TestStand Application Manager supports processing custom command line arguments through the ProcessUserCommandLineArguments event. This can prove useful when automating test execution from a CI server.

Description

 

This example is similar to the LabWindows/CVI Basic User Interface, but has been modified to accept the following command line arguments:

Option Purpose
/SimulateFailure <failures> When used with the included example sequence file, this suppresses the simulation dialog and instead simulate failures as specified. This argument accepts the following parameters:
  • Keyboard
  • Video
  • Power
  • CPU
  • ROM
  • RAM
If no parameters are specified, then all components are simulated to pass.

 

This example demonstrates the following concepts:

  • Using TSUI__ApplicationMgrEventsRegOnProcessUserCommandLineArguments to handle custom command line arguments
    Spoiler
  • Modifying a TestStand user interface to print UI error messages to the console and set the return code appropriately
    Spoiler
  • Use of the TSUI_ApplicationMgrAddCommandLineArgumentsHelp function to add custom command line arguments help.
    Spoiler
  • Creating a custom UI Message handler to pass command line data to sequence execution.
    Spoiler

Note: By default, TestStand shows dialogs under certain conditions. This can cause hangs when automating sequence execution without user input, such as when ran from a CI Server. In order to prevent popups that require user input, configure the following options:

  • Disable User Management or automatically log in the System User
  • Set the 'Station Options » Execution »  On Run-Time Error' setting to something other than 'Show Dialog', such as 'Run Cleanup'.
  • Specify 'Station Options » Time Limits' for Exiting and Normal Execution such that the user will not be prompted.
  • Pass the /quit argument via the command line so TestStand automatically shuts down after all executions are complete.

Hardware and Software Requirements

TestStand 2014 SP1 or later

LabWindows/CVI 2015 or later

Steps to Implement or Execute Code

  1. Unzip the attached code, open the .cws, and build the project for the bitness of TestStand you have.
  2. Open a command window in the <ExampleDir>\ModifiedBasicOI_CVI directory (Shift + Right Click » Open command window here).
  3. In order to see the Command Line help, run:

    TestExec /?

  4. Experiment with the /SimulateFailure argument. For example:

    TestExec /runEntryPoint "Single Pass" "<ExampleDir>\TestSequence\Computer Motherboard Test Sequence.seq" /SimulateFailure Keyboard Video RAM /quit

https://www.linkedin.com/in/trentweaver

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.