Example Code

NI TestStand Featured Examples

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

Third-Party Code Repository

Some users manage their code in repositories outside of ni.com. Use your best judgment when following links to third-party sites. https://forums.ni.com/t5/Example-Code/tkb-p/3039

Description

Overview

The NI TestStand Featured Examples document highlights a number of useful TestStand examples available on the web.  These examples serve as a supplement to the examples that are included with TestStand.

List of All Featured Examples

The following examples are featured on this page:

Custom TestStand User Interface Examples

These examples illustrate useful additions to the User interfaces that are included with TestStand.  For more information on customizing and creating TestStand User Interfaces, refer to the Best Practices for NI TestStand User Interface Development document (part of the NI TestStand Advanced Architecture Series).

Multi-window TestStand User Interface

These examples shows how the User Interfaces included with TestStand can be modified to display test sequences and executions in separate windows, allowing the user to view all socket executions simultaneously.

LabVIEW Implementation

[View This Example]

This modification is implemented through the use of a dynamic VI call, which calls a new instance of the execution viewer VI for each active execution.  Each instance of the execution viewer VI contains a separate TestStand Execution manager control, which handles the display of the execution independently of the main interface VI. 

.NET Implementation

[View This Example]

This modification is implemented using the Multiple Document Interface (MDI) provided through the Windows.Forms class.  As TestStand creates new executions, the application dynamically creates new child windows within the parent User Interface window. 

Dynamic Panels in a TestStand User Interface

These examples demonstrate how to add an embedded panel to the User interface which can be dynamically populated with code module User Interfaces, or other relevant information about the test.

LabVIEW Implementation

[View This Example]

This implementation contains code to automatically detect if any LabVIEW code modules are called which display a front panel.  When such a module is found, the panel is embedded into the user interface directly within a LabVIEW sub-panel, rather than displaying in a new window.

LabWindows/CVI Implementation

[View This Example]

This implementation uses a set of custom step types, which communicate with the user interface and allow you to easily execute DLL modules within the embedded panel.  By using a dynamic panel, test developers can add custom code to the user interface without modifying the User Interface code directly.



Sending Data from the TestStand User Interface to an Executing Sequence (LabVIEW)

[View This Example]

Sending information to the TestStand User Interface is fairly straightforward through the use of UI messages, but communicating User Interface information, such as user interaction, to an executing sequence file is not as simple.  This example implements the recommended approach: initiating the communication from the executing sequence using a custom UI message, then sending the user interface updates to the sequence in the UI message callback code.  This method ensures that the execution is suspended while the data is transferred, preventing potential race conditions.

Custom Step Type Examples

These Examples show how custom step types can be used to expand the functionality of your sequences, and provide code to ease the process of developing your own custom steps.  For more information on customizing and creating TestStand Step Types, refer to the Best Practices for Custom Step Type Development document (part of the NI TestStand Advanced Architecture Series).

TCP Communication Step Types (CVI)

https://forums.ni.com/t5/Example-Programs/TestStand-Test-Time-Profiler/ta-p/3632154

This example provides a set of custom step types that you may insert into TestStand sequences to perform basic TCP client operations, such as Connect, Read, Write, and Disconnect, without having to call any additional code modules.The TCP steps use the TestStand CVI Adapter to communicate with a DLL created with LabWindows/CVI.

TestStand Utilities

These examples are supplemental tools that ease development or provide additional functionality to TestStand

Test Time Profiler

[View This Example]

This TestStand example demonstrates how you can visually determine which tests are limiting your test throughput by creating a graphical profile in the report of the test time required by each step in your sequence. TestStand automatically keeps track of the time each step in your sequence requires to execute.

Note: In TestStand 2012, this functionality is available in the basic test time report example, which is included with TestStand.

Other NI TestStand Resources

 

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