Example Code

Really Simple TestStand User Interface (Run a Test With a Single Button Press)

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

 

I have spoken with several customers who have wanted a really really simple user interface for their users, but don't have any experience in building a TestStand User Interface themselves. The shipping user interfaces are great for many peoples teststand deployments, but we may want to limit the operator in what they are able to do.

For example, one customer I spoke two just had two different sequences, and he wanted a button to run the first sequence, and a button to run the second one. We may also want to prevent the user from running multiple executions at once (particularly if we don't lock access to hardware, etc)

I expect many people may also just want to deploy a system where the operator can simply press a button, have the sequence execute, and view the report that is generated.


Description

This example has a scalable setup, which means that the same code can be easily modified to add in more tests. I initially built this for the situation described above, with two tests to run, but it only took me 1 minute to remove some elements, and to reduce it to a single test. Similarly, it could be just as easily scaled to add more tests. I have bookmarked the locations where you have to make code changes.

The test sequences I have included are just dummy sequences, one passes and one fails.

How I made my TestStand UI

To make this particular example, I started from the pre-built "Simple" LabVIEW User interface. There is still quite a lot to this, and is a good starting point if you want to build your own user interfaces.

A few things to note about the code in this example:

1.I have used LabVIEW events to process when my operator wants to run a test, rather than using the TestStand ActiveX buttons. In the subVI "Run Sequence", I open a reference to the single pass execution entry point, and run this.

2.We use ActiveX Callbacks to register when TestStand sends a message to the user interface. I have left some of the existing ones here, and removed some which I didn't need. I also added a callback VI for the "ExecutionEnd" message, at which point I enable the test buttons again. This means I can limit the user to one execution at a time

3.Closing an execution closes the report too, I wanted this to remain after the execution completes, so I have closed the execution before starting a new one each time, you can see this in the event structure

4.I have extensively documented the code, including documentation on all the initialization, and all the places where you are likely to have to change the code, utilizing the new attached free labels in LV2013, and bookmarks.

 


Requirements

  • LabVIEW 2013 (or later)
  • TestStand 2012 (or later)


Steps to Implement or Execute Code

1.Download and unzip the attached .zip file.

2.Open the TSUI.lvproj file.

3.Open either the Dual or Single Interface.

4.Hit run, the rest should be obvious.

 

References:

Best Practices for NI TestStand User Interface Development

Understanding the TestStand Simple User Interface

Using TestStand User Interface Messages

 

 **This document has been updated to meet the current required format for the NI Code Exchange.**

 

Ian S
Applications Engineer CLA
National Instruments UK&Ireland

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