Академический Документы
Профессиональный Документы
Культура Документы
Course Manual
Copyright
Copyright © 2001 National Instruments Corporation. All rights reserved.
Under the copyright laws, this publication may not be reproduced or transmitted in any form, electronic or mechanical, including
photocopying, recording, storing in an information retrieval system, or translating, in whole or in part, without the prior written consent
of National Instruments Corporation.
Trademarks
CVI™, LabVIEW™, and TestStand™ are trademarks of National Instruments Corporation.
Product and company names mentioned herein are trademarks or trade names of their respective companies.
Worldwide Technical Support and Product Information
ni.com
Worldwide Offices
Australia 03 9879 5166, Austria 0662 45 79 90 0, Belgium 02 757 00 20, Brazil 011 284 5011, Canada (Calgary) 403 274 9391,
Canada (Ottawa) 613 233 5949, Canada (Québec) 514 694 8521, China (Shanghai) 021 6555 7838,
China (ShenZhen) 0755 3904939, Denmark 45 76 26 00, Finland 09 725 725 11, France 01 48 14 24 24, Germany 089 741 31 30,
Greece 30 1 42 96 427, Hong Kong 2645 3186, India 91805275406, Israel 03 6120092, Italy 02 413091, Japan 03 5472 2970,
Korea 02 596 7456, Mexico 5 280 7625, Netherlands 0348 433466, New Zealand 09 914 0488, Norway 32 27 73 00,
Poland 0 22 528 94 06, Portugal 351 1 726 9011, Singapore 2265886, Spain 91 640 0085, Sweden 08 587 895 00,
Switzerland 056 200 51 51, Taiwan 02 2528 7227, United Kingdom 01635 523545
Contents
Introduction
Introduction................................................................................................................. xi
Technical Support Options ......................................................................................... xii
Course Objectives....................................................................................................... xiii
Course Map................................................................................................................. xiv
Items You Need for This Course ................................................................................ xv
Lesson 1
Introduction to TestStand
Introduction to TestStand ........................................................................................... 1-1
The Role of a Test Executive...................................................................................... 1-2
Our Goal for TestStand............................................................................................... 1-3
What is TestStand? ..................................................................................................... 1-4
The TestStand Architecture ........................................................................................ 1-5
The Sequence Editor................................................................................................... 1-6
The Operator Interface................................................................................................ 1-7
TestStand Engine ........................................................................................................ 1-8
Module Adapters ........................................................................................................ 1-9
The TestStand Architecture ........................................................................................ 1-10
Summary..................................................................................................................... 1-13
Exercise 1-1 Running a Sequence File.................................................................. 1-14
Exercise 1-2A Running a Sequence File from the LabVIEW
Operator Interface ............................................................................ 1-19
Exercise 1-2B Running a Sequence File from the
LabWindows/CVI Operator Interface .............................................. 1-24
Lesson 2
The TestStand Environment
Introduction................................................................................................................. 2-1
What is a sequence?.................................................................................................... 2-2
Step Groups ................................................................................................................ 2-3
TestStand Sequence Files ........................................................................................... 2-4
Debugging Tools ........................................................................................................ 2-5
The TestStand Process Models................................................................................... 2-8
Available TestStand Process Models.......................................................................... 2-9
Lesson 3
Creating Sequences
Introduction.................................................................................................................3-1
How to Create Test Sequences ...................................................................................3-2
Step 1 : Specify the Adapter .......................................................................................3-3
Step 2: Select the Step Type .......................................................................................3-4
Step Types...................................................................................................................3-5
Step 3: Specify the Test Module.................................................................................3-6
Specifying the Module................................................................................................3-7
Specifying the Module: Search Directories ................................................................3-8
Step 4: Configure Step Properties...............................................................................3-9
Step Properties: General Tab ......................................................................................3-10
Step Properties: Preconditions ....................................................................................3-11
Step Properties: Run Options Tab ..............................................................................3-12
Step Properties: Run Options Tab (Continued) ..........................................................3-13
Step Properties: Run Options Tab (Continued) ..........................................................3-14
Step Properties: Post Actions Tab ..............................................................................3-15
Step Properties: Loop Options Tab.............................................................................3-16
Step Properties: Loop Options Tab (Continued) ........................................................3-17
Step Properties: Synchronization Tab.........................................................................3-18
Step Properties: Expressions Tab ...............................................................................3-19
Useful Step Type Features ..........................................................................................3-22
Sequence Call Options................................................................................................3-23
IVI Step Type Demo...................................................................................................3-24
Exercise 3-1 Creating Steps in the Sequence Editor .............................................3-28
Exercise 3-2 Configuring Loop Options ...............................................................3-38
Exercise 3-3 Creating a Sequence .........................................................................3-42
Exercise 3-4 Running Sequences in Parallel (Optional) .......................................3-60
Lesson 4
TestStand Parameters, Variables, and Expressions
Introduction.................................................................................................................4-1
TestStand Variables ....................................................................................................4-2
Parameters...................................................................................................................4-3
Parameters: Passing data to subsequences..................................................................4-4
Local Variables ...........................................................................................................4-5
Creating Local Variables ............................................................................................4-6
Sequence File Global Variables..................................................................................4-8
Creating Sequence File Global Variables ...................................................................4-9
Station Globals............................................................................................................4-10
RunState Property Object ...........................................................................................4-11
RunState Subproperties...............................................................................................4-12
RunState Property Example........................................................................................4-13
The Expression Browser .............................................................................................4-14
Using the Expression Browser....................................................................................4-15
Defining Variables and Parameters ............................................................................4-16
Summary .....................................................................................................................4-21
Exercise 4-1 Using Local Variables ......................................................................4-22
Exercise 4-2 Examine the Uses and Differences between Locals,
File Globals, and Station Globals.....................................................4-25
Exercise 4-3 Using Expressions to Change Step Properties..................................4-32
Exercise 4-4 Passing Parameters ...........................................................................4-41
Exercise 4-5 Dynamically Selecting Which Sequence to Run..............................4-53
Lesson 5
Creating Test Modules in External Environments
Introduction.................................................................................................................5-1
Creating Tests in External Environments ...................................................................5-2
Data Transfer in TestStand .........................................................................................5-3
Using Clusters to Pass Data from LabVIEW..............................................................5-4
Using Structures to Pass Data from LabWindows/CVI..............................................5-6
Method 2—Passing Parameters Directly Without Using Structures ..........................5-8
Method 3—Using the ActiveX Automation API to Access Properties
and Methods .............................................................................................................5-12
What is ActiveX Automation?....................................................................................5-13
Summary of ActiveX Automation ..............................................................................5-14
TestStand and ActiveX Automation ...........................................................................5-15
ActiveX Automation in LabVIEW .............................................................................5-16
An Example of ActiveX Automation in LabVIEW....................................................5-17
ActiveX Automation in LabWindows/CVI ................................................................5-18
An Example ActiveX Automation in In LabWindows/CVI.......................................5-19
Using TestStand Code Templates...............................................................................5-24
Code Templates ..........................................................................................................5-25
Summary .....................................................................................................................5-26
Lesson 6
User Management
Introduction.................................................................................................................6-1
The TestStand User Manager .....................................................................................6-2
Default User Profiles ..................................................................................................6-3
Windows System Users ..............................................................................................6-5
Summary .....................................................................................................................6-6
Exercise 6-1 Setting User Login Access and Privileges........................................6-7
Lesson 7
Result Collection and Report Generation
Introduction.................................................................................................................7-1
When and Where Results are Stored ..........................................................................7-2
What Results are Stored..............................................................................................7-3
View of Actual Results ...............................................................................................7-4
Subsequence Results...................................................................................................7-5
Formatting Results into a Report ................................................................................7-6
Report Configuration Options ....................................................................................7-7
Report Options Dialog Box: Contents Tab.................................................................7-8
Report Options Dialog Box: Report File Pathname Tab ............................................7-9
Inserting Message in Report .......................................................................................7-10
Using an External Report Viewer from TestStand .....................................................7-11
Summary .....................................................................................................................7-13
Exercise 7-1 Customizing Report Generation .......................................................7-14
Lesson 8
Database Interaction
Introduction.................................................................................................................8-1
Database Concepts ......................................................................................................8-2
Structured Query Language (SQL).............................................................................8-3
Database Interface Technologies ................................................................................8-4
Database and Database Drivers ..................................................................................8-5
Configuring Database Options: Logging Options ......................................................8-6
Configuring Database Options: Data Link .................................................................8-7
Configuring Database Options: Schemas ...................................................................8-8
Configuring Database Options: Statements ................................................................8-9
Configuring Database Options: Columns/Parameters ................................................8-10
Logging Property ........................................................................................................8-11
Default Schema: Generic Recordset ...........................................................................8-12
Creating Default Database Tables ..............................................................................8-13
Database Viewer .........................................................................................................8-14
Open Database Step Type...........................................................................................8-18
Open SQL Statement Step Type .................................................................................8-19
Open SQL Statement: Build SQL Select Statement Dialog Box ...............................8-20
Data Operation Step Type...........................................................................................8-21
Data Operation Step Type (Continued) ......................................................................8-22
Data Operation Step Type (Continued) ......................................................................8-23
Data Operation Step Type (Continued) ......................................................................8-24
Close SQL Statement Step Type ................................................................................8-25
Close Database Step Type ..........................................................................................8-26
Summary .....................................................................................................................8-28
Exercise 8-1 Logging UUT Results to Database...................................................8-29
Exercise 8-2 Using Database Step Types ..............................................................8-42
Lesson 9
The Operator Interface
Introduction.................................................................................................................9-1
The Operator Interface................................................................................................9-2
Available Operator Interfaces .....................................................................................9-3
Operator Interface Functionality.................................................................................9-4
Sequence Display........................................................................................................9-5
Execution Display.......................................................................................................9-6
How the Operator Interface Works.............................................................................9-7
What is a UIMessage? ................................................................................................9-8
Summary .....................................................................................................................9-10
Exercise 9-1 Running Tests from the Operator Interface......................................9-11
Lesson 10
Additional Topics
Introduction.................................................................................................................10-1
Import/Export Properties ............................................................................................10-2
Import/Export Properties Dialog Box.........................................................................10-3
The Property Loader Step ...........................................................................................10-4
Importing/Exporting Values Summary.......................................................................10-8
Distributing TestStand ................................................................................................10-9
TestStand Run-Time Engine.......................................................................................10-10
Distribute the Operator Interface ................................................................................10-11
Distribute Sequences and Code Modules ...................................................................10-12
Exercise 10-1 Importing and Exporting Properties .................................................10-13
Exercise 10-2 Using the Property Loader Step Type...............................................10-19
Exercise 10-3 Using the Expressions to Load Properties........................................10-24
Appendix A
Introduction to Interchangeable Virtual Instruments
Introduction to Interchangeable Virtual Instruments (IVI).........................................A-1
What is an Instrument Driver?....................................................................................A-2
What is IVI?................................................................................................................A-3
IVI Instrument Drivers................................................................................................A-4
IVI Instrument Drivers (Continued) ...........................................................................A-5
IVI Driver ...................................................................................................................A-6
IVI Attribute Model ....................................................................................................A-7
State Caching ..............................................................................................................A-8
Range Checking ..........................................................................................................A-9
Simulation ...................................................................................................................A-10
Standardization ...........................................................................................................A-11
Instrument Classes ......................................................................................................A-12
IVI Class Specification ...............................................................................................A-13
IVI Driver Standard ....................................................................................................A-14
Where Does IVI Fit In? ..............................................................................................A-15
Using IVI Instrument Specific Drivers .......................................................................A-16
Using IVI Instrument Specific Drivers (Continued)...................................................A-17
Types of IVI Drivers...................................................................................................A-18
Interchangeable Drivers ..............................................................................................A-19
IVI Architecture ..........................................................................................................A-20
IVI Configuration .......................................................................................................A-21
TestStand I: Fundamentals
Course Manual
National Instruments
11500 N. MoPac Expressway
Austin, Texas 78759
(512) 683-0100
Introduction
TestStand is a powerful, flexible, and easy-to-use test executive software program. Built around an
intuitive explorer-style interface and able to execute tests created in a variety of test development
environments, TestStand enables developers to build sophisticated testing programs customized to
their exact needs.
This course introduces the TestStand environment and teaches you how to use TestStand for your
test executive applications. The main emphasis of this course is to cover the fundamental,
off-the-shelf features that TestStand offers. A background knowledge of test executive software and
a familiarity with either LabVIEW or C programming is required for this course.
Course Objectives
• Introduce the TestStand architecture
• Demonstrate the powerful off-the-shelf capabilities of
TestStand
Course Objectives
This TestStand course teaches you the fundamentals of the TestStand environment. It begins with
a background discussion of the TestStand architecture, including an overview of each constituent
part. The course then discusses the TestStand environment and demonstrates how to use TestStand
to create a test management program. The course concludes by showing you how to distribute
TestStand and your test sequences.
Course Description
The course is divided into lessons that teach a topic or a set of topics. Each lesson consists of:
• An introduction that describes the lesson’s objectives and the topics discussed.
• A discussion of the topics.
• A set of hands-on exercises that reinforce the concepts presented in the discussion. (Some of
the exercises are duplicated for LabVIEW and LabWindows/CVI, so you can work in your
preferred programming environment. For duplicate exercises, select one of the exercises to
complete during the time allotted.)
• A summary that highlights the concepts covered in the lesson.
Course Map
Day 1 Day 2
TestStand User Management
Environment
Result Collection
Variables, Report Generation
Properties, and
Expressions
Database Features
Creating Test
Modules in External Distributing
Environments TestStand
Course Map
Over the next two days, the course addresses several key concepts of TestStand.
Lessons 1 through 4 introduce the TestStand development environment. These lessons present
basic operations in opening and creating sequence files and using variables, properties, and
expressions.
Lesson 5 explains how TestStand communicates with external programming environments and
how you can create TestStand-compatible test modules in these environments.
Lessons 7 through 10 address collecting results and generating reports, logging results to a
database, using the property loader, and distributing TestStand to other test stations.
TestStand I:
Fundamentals
Course Manual
TestStand
Computer running Windows 95/NT/98 Development
with an internal PC speaker Course disks
(Recommended: Pentium II 266 MHz
or better and 64MB RAM)
Install the course software by inserting the course disks and extracting the contents of the
self-extracting archives into your C:\Exercises\TestStand I directory. The solutions to all
exercises should be installed in the C:\Solutions\TestStand I directory.
You also need LabVIEW 6.0 or later, LabWindows/CVI 5.5, and Excel 97 or Excel 97 Viewer for
some of the exercises.
Hands-On Exercises
Introduction to TestStand
This lesson introduces the basic TestStand concepts and the development environment architecture.
The first part introduces the role of a test executive in a test environment and the tasks it performs.
The third part describes the TestStand architecture and provides detailed information about its
constituent parts. The exercises introduce two of the constituent parts of TestStand, the Sequence
Editor and the Operator Interface.
ve
• Configuring instruments • User management
uti
• Data acquisition • Unit Under Test (UUT) tracking
ec
Ex
• Measurements • Test flow control
st
• Analyzing results • Archiving results
Te
• Test strategies • Test reports
Test executive programs execute operations that are repeated for each product. Operations such as
displaying the user interface, providing user management, performing step branching, archiving
results, and creating test reports are similar for each product tested, and are therefore handled by a
test executive.
The other set of operations, such as calibration and configuration routines, data acquisition and
measurement, analysis of results, and developing test strategies, are different for each product.
These operations are written in other environments (for example, LabVIEW and/or
LabWindows/CVI) and implemented as steps in a test executive program.
Thus, a test executive allows test engineers to concentrate on developing tests for their products
while providing the basic operations needed for testing environments. This allows test engineers to
develop test modules efficiently without redundant code development.
The goal of TestStand is to provide a product that is versatile and flexible enough that users can
both easily use TestStand for their testing needs and customize TestStand quickly to create their
own custom test executive systems. As you proceed with the course, you will see how TestStand
meets the first goal and in the advanced course you will see how TestStand meets the second goal.
What is TestStand?
What is TestStand?
You can think of TestStand as two products in one. On the one hand, it is a ready-to-run test
executive. Right out of the box, you can use it to develop sophisticated sequences to track UUTs
and log and display data. Furthermore, because TestStand can call test modules written in a variety
of languages, TestStand sequences can integrate a variety of existing code.
TestStand goes beyond just building sequences. The test developer can customize almost every
aspect of TestStand itself. So, in effect, TestStand is a tool for building your own test executive.
It is important to understand how each component fits into the test software design stages:
• Sequence Editor—for developing, debugging, and executing sequences
• Operator Interfaces—for executing and debugging sequences on the production floor
• TestStand Engine—an Active X server that performs the test executive operations
• Module Adapters—enable TestStand to interface with external development environments
TestStand Architecture:
Sequence Editor
The Sequence Editor is the development environment from which you can build and debug your
test sequences. The Sequence Editor also has features like source code control and workspaces that
help you manage your test development.
TestStand Architecture:
Operator Interface
TestStand currently includes four operator interfaces in both source code and executable form.
Each run-time operator interface is a separate application program, differing primarily with respect
to the application development environment (ADE) in which each was developed. TestStand ships
with run-time operator interfaces developed in LabVIEW, LabWindows/CVI, Delphi, and Visual
Basic. In addition to the these programming environments, you can write the Operator Interface in
any programming environment that supports ActiveX client functionality.
Although you can use the TestStand Sequence Editor at a production station, the TestStand
run-time operator interfaces are simpler and fully customizable, thus making them more suitable
applications for deployment. This course explains the operator interfaces in more detail in a later
lesson.
TestStand Architecture:
TestStand Engine
TestStand Engine
At the core of the TestStand architecture is the TestStand Engine. The engine is implemented as a
set of 32-bit Dynamic Link Libraries (DLLs) that export an ActiveX API. The TestStand Engine
handles test executive tasks such as sequencing, branching, looping, limit checking, data
allocation, and user management. The engine is optimized for speed and designed for maximum
flexibility and long-term compatibility.
The TestStand Sequence Editor and run-time operator interfaces use the engine API for creating,
editing, executing, and debugging sequences. You can call the engine API from any programming
environment that supports access to ActiveX Automation servers. You can even call the engine API
from test modules, including test modules you create in LabVIEW and LabWindows/CVI.
ActiveX Automation and the TestStand API are discussed more thoroughly later in the course.
TestStand Architecture:
Module Adapters
Module Adapters:
• Allow TestStand to integrate with various languages
• Execute test modules at run-time
• Step into test modules
• Generate test module templates
TestStand
Module Adapters
To communicate with external code modules, TestStand must know the code module type, how
to call it, and how to pass parameters to it. Module adapters integrate TestStand with external
environments. The adapters act as an interface between TestStand and external test development
environments, supplying the necessary information for communication between the two
environments.
Module adapters allow TestStand to execute test modules, pass and receive data, generate test
module templates, and even debug code written in another programming language. TestStand can
call a test written in any language for which it has an adapter. Currently, there are adapters for
LabVIEW, LabWindows/CVI, Dynamic Linked Libraries (DLLs), ActiveX Automation servers,
sequences, and HTBasic. These adapters can call different types of code modules: TestStand
sequences, LabVIEW VIs, HTBasic subroutines, C functions in DLLs, and C functions in source,
object, or library modules that you create in LabWindows/CVI or other compilers.
Module adapters allow you to integrate your existing test software and tools. Adapters help you
benefit from the fully customizable features of TestStand and the investment you have already
made in your existing test software infrastructure.
Note When creating TestStand sequences, you can use different adapters within the
same sequence.
TestStand Architecture
Samples in ActiveX
Source: Custom Clients
Operator Sequence
LV, CVI, VB Interface Editor
In Exercise 1-1, you will examine the Sequence Editor and one of the sample operator interfaces.
Exercise 1-1
Lesson 1 Summary:
Introduction to TestStand
Summary
A test executive program performs tasks in the testing environment that are repetitive for different
products tested. This allows you to focus on creating the test modules and prevents redundant
programming.
TestStand is a ready-to run test executive software program that is fully customizable so that you
can modify TestStand to fit your needs.
In the rest of the course, you will learn how to use and develop tests using these key TestStand
components.
Run Main Sequence allows you to execute the sequence without using
the process model. (The process model is discussed in future lessons.)
This mode can test only how your main sequence proceeds, because no
other parts of the process model are executed in this type of execution.
For now, the only noticeable difference is that no report is generated, as
compared to the Test UUTs or Single Pass entry points. The process
model as used by the Test UUTs and Single Pass entry points is
explained later in this course.
5. Use the Motherboard Test Simulator dialog box to select the tests you
want to fail. To do this, click on the check boxes beside the name of the
part you want to set to fail. (An X appears in the box when you select it.)
Note Checking the CPU test does not cause a failure, because that step is not yet
included in the sequence. This dialog box is called in the Setup step group of this test
sequence file. Lesson 2 includes an explanation of step groups.
6. Notice that another window is created in the Sequence Editor when the
sequence begins execution. This is the execution window, while the
window that was initially open is the sequence file window.
The Sequence Editor used in the previous exercise is not the only
application for executing tests. The operator interface used in this exercise
is another interface to execute tests. This interface was built with LabVIEW
and is the interface the operator uses on the production floor.
The operator interface looks similar to the Sequence Editor, because it has
most of the same functionality. The two critical differences between the
operator interface and the Sequence Editor are:
• Currently, the operator interface cannot modify or create sequence files,
unlike the Sequence Editor.
• The Sequence Editor is not provided with source code, and therefore you
cannot modify it. On the other hand, the operator interface source code
is included with the TestStand installation and is meant to be modified
so that every user can create a customized operator interface. The source
code for the default operator interfaces included with TestStand is in the
following directory:
<TestStand path>\Examples\OperatorInterfaces
Note TestStand can run multiple sequence executions in parallel. Switching back to the
sequence display window and clicking the Test UUT button again causes the sequence
to begin executing a second time in a separate execution display window from the first
execution. Additionally, you can load and execute a separate sequence file in parallel
instead of executing the same sequence file. Lesson 3 includes an example of executing
sequences in parallel.
6. When you finish viewing the report file, close the web browser that
TestStand used to display the file. Click on the execution display
window to bring it to the front and close it by selecting File»Close
Execution. Next, bring the sequence display window to the front by
clicking on it, and close the sequence by selecting File»Close Sequence
File. Finally, close the operator interface by selecting File»Exit from
the sequence display window.
The Sequence Editor used in the previous example is not the only
application for executing tests. The operator interface used in this exercise
is another interface to execute tests. The interface used in this exercise was
built with LabWindows/CVI and is the interface the operator uses on the
production floor.
The operator interface looks similar to the Sequence Editor, because it has
most of the same functionality. The two critical differences between the
operator interface and the Sequence Editor are:
• Currently, the operator interface cannot modify or create sequence files,
unlike the Sequence Editor.
• The Sequence Editor is not provided with source code, and therefore you
cannot modify it. On the other hand, the operator interface source code
is included with the TestStand installation and is meant to be modified
so that every user can create a customized operator interface. The source
code for the default operator interfaces included with TestStand is in the
following directory:
<TestStand path>\Examples\OperatorInterfaces
4. Execute the sequence by clicking the Test UUTs button. This displays
the UUT Information dialog box (shown below) and the execution
display window (shown on the next page). Type in any value for the
serial number and click OK. As in the previous exercise, try setting
different tests to fail before stopping the test to view the report.
Notes
Lesson 2:
The TestStand Environment
Introduction
This lesson discusses TestStand sequences, their component step groups, and sequence files. It then
introduces the debugging tools available in TestStand and explains how to execute them in the
Sequence Editor. It also discusses the concept of a process model, and explains how TestStand can
use the various default process models to execute tests. Test file management tools are also
discussed in this lesson.
TestStand Sequences
What is a sequence?
• A test sequence consists of a series of test modules
and flow control settings used to test a Unit Under
Test (UUT)
• Each line of a sequence is called a step
Sequence
Step 1
Default Execution
Direction
Step 2
Step 3
What is a sequence?
Before getting into TestStand sequence files, it helps to examine a sequence at its most basic level.
A sequence is a series of TestStand steps combined with the control logic that determines the order
in which those steps are executed. Each step performs a particular action that contributes to the
overall testing of the UUT. For example, in a step you could execute a LabVIEW VI that performs
some type of test. The default operation is such that TestStand begins sequence execution with the
topmost step and executes the steps from top to bottom. However, you can control the sequence’s
execution flow; this is addressed in the next lesson.
TestStand Sequences:
Step Groups
As shown below, all TestStand sequences have
three step groups
TestStand Sequence
Cleanup
Main
Setup
Steps
Step Groups
Within every TestStand sequence, there are three step groups: setup, main, and cleanup. These step
groups are always executed in the same order: setup, main, and cleanup. The step groups organize
a series of sequence steps in a logical and sequential manner. For example, the setup group might
contain initialize or power-up routines, the main group might contain the actual test routines, and
the cleanup group might contain steps to close files or power-down instruments. The default
settings for TestStand are such that the cleanup steps are executed even if there is a run-time error.
To illustrate this concept, consider a bar code scanning application. Assume that for a particular
product, the serial number is read by scanning a bar code, but for all other products, an operator
enters it. The test developer would include the Pre-UUT callback (the callback that includes the
serial number inquiry) in the sequence file for that product, and edit it to include the bar code
scanning routines. Each time that particular sequence file is loaded, TestStand recognizes that it has
its own Pre-UUT callback sequence and uses it. However, when other sequence files are loaded,
TestStand still uses the default Pre-UUT callback, which prompts the operator to enter a serial
number.
Thus, the sequence file is a TestStand application file that contains all information necessary for
TestStand to load and execute a particular test application.
Debugging Sequences
Debugging Tools
TestStand has a variety of debugging tools that help you verify the execution of your TestStand
applications.
The execution tracing option allows you to view the execution flow for the sequence in the
execution window. If tracing is enabled, the Sequence Editor displays the progress of an execution
by placing a yellow arrow icon to the left of the icon for the currently executing step. You can adjust
the speed of tracing by selecting Configure»Station Options and adjusting the slider on the
Execution tab.
The Sequence Editor and operator interfaces allow you to set breakpoints, step into, step over, or
step out of sequences, and set the next step to execute. You can also view variables and create watch
expressions (combination of variables). These tools allow you to control the sequence execution
manually and identify potential areas that require further modification. The debugging tools are
addressed in greater detail in Exercises 2-1 and 2-2.
Exercise 2-1
Exercise 2-2
TestStand Sequences:
The Process Models
What is a Process Model?
A Process Model is a list of steps that specify the
high level flow of execution in a test system
About the Process Models:
• There are 3 available process models:
– SequentialModel.seq
– BatchModel.seq
– ParallelModel.seq
• The default model is SequentialModel.seq
• The process models have two modes of operation:
– Test UUTs
– Single pass
TestStand has three available process models. By default, TestStand uses the sequence file
SequentialModel.seq as its process model. The TestStand process models contain sequences
that define operations TestStand performs before and after it tests a UUT. To invoke (or execute) a
sequence in a process model, run one of the Execution Entry Point sequences in the model.
The TestStand process models have two modes of operation called execution entry points. They
appear as the Test UUTs and Single Pass selections in the Execute menu. Single Pass is usually
for debugging purposes; it executes the selected sequence file only once and generates a test report.
Test UUTs is for testing multiple UUTs. It loops until the operator quits and generates a test report
for all UUTs. The Test UUTs mode is discussed next.
Note If you modify the process models under \TestStand\Components, notice that
there are two subdirectories for the process models: NI and User. Always copy the
process models into the User directory so that you maintain a copy of the originals.
• BatchModel.seq
– Process model used to control a set of test sockets that tests
multiple UUTs as a group or “batch”
• ParallelModel.seq
– Process model used for handling multiple independent test
sockets
The Batch process model, BatchModel.seq, can be used for controlling a set of test sockets that
test multiple UUTs as a group. For example, you might have a set of circuit boards attached to a
common carrier. The Batch model ensures that you start and finish testing all boards at the same
time. The Batch model also provides batch synchronization features in which you can indicate that
a step applies to the batch as a whole and therefore the step would only run once per batch instead
of once for every UUT. Another convenient feature is the ability of the Batch model to generate
batch reports that summarize the test results for all UUTs in the batch.
The Parallel process model, ParallelModel.seq, can be used for handling multiple
independent test sockets. The Parallel model allows you to start and stop testing on any socket at
any time. For example, you might have five test sockets for testing radios. The Parallel model
allows you to load a new radio into an open socket while the other sockets are busy testing other
radios.
The next step is the MainSequence step, which the user creates using the Sequence Editor.
TestStand then executes the Post-UUT Callback (UUT clean up operations) and updates a test
report. Execution then returns to the Pre-UUT Callback for the next UUT to be tested. On
completion of testing, TestStand steps out of the loop, generates a test report, and executes the
Post-UUT Loop Callback test (system clean up operations).
The Sequential process model contains model callbacks, which are normal TestStand sequences,
with the exception that these callbacks perform specific tasks during sequence execution. For
example, the Pre-UUT Loop Callback can run setup sequences for testing. The model callbacks
can serve as hooks for you to customize the process model for each MainSequence without
altering the process model directly.
SequentialModel.seq
SequentialModel.seq
Execution entry points in process models, such as Test UUTs and Single Pass, use callbacks to
invoke the MainSequence in your sequence file.
Each sequence file must then define a sequence by the name of MainSequence. The default process
model, SequentialModel.seq, contains a MainSequence callback that is merely a place holder.
The MainSequence in your sequence file overrides the MainSequence place holder in the
SequentialModel.seq.
As shown in the slide above, the default TestStand process model is itself just another sequence file
called SequentialModel.seq. Thus, you can completely edit and customize the process model.
It includes all the callback sequences (as displayed in the pull down View ring), various steps used
for sequencing logic and keeping track of certain TestStand variables, and execution entry points.
Exercise 2-3 introduces you to the default process model sequence file in greater detail.
PROCESS
Application Programming Interface MODEL
Callbacks
Exercise 2-3
• Workspaces
– organize sequence files, code modules, and other files
into projects
• Projects
– enables you to access related files quickly
• Source Control
– check files and projects in and out of a source code
control system
• Differ
– graphical tool that enables you to compare and merge
differences between two sequence files
The workspace window displays the contents of a TestStand workspace (.tsw) file. A workspace
file displays a list of any number of TestStand project (.tsp) files. In TestStand, a project file can
contain any type of file or folder but a workspace file can contain only projects.
TestStand integrates with any source code control system that supports the Microsoft SCC
interface. You can check files and projects in and out of your source code control system from a
TestStand workspace. TestStand has been tested with the following source code control providers:
Microsoft Visual SourceSafe, Perforce, MKS Source Integrity, and Rational ClearCase.
The TestStand Differ is a graphical tool in the Sequence Editor that enables you to compare and
merge differences between two sequence files. The TestStand Differ compares the sequence files
and presents the differences in a new window.
For more details on these features, please see the TestStand User Manual.
You can use the TestStand Differ tool by opening a sequence file in the Sequence Editor and
selecting Edit»Diff Sequence File With from the menu. A graphical window will then be
displayed that shows you the differences between the compared sequence files.
Lesson 2 Summary:
The TestStand Environment
• A test sequence is a series of test modules and flow control
settings used to test a UUT
• There are three step groups in a sequence: Setup, Main, and
Cleanup
• Sequence files contain user-defined main sequences and
callback sequences required for sequence execution
• A process model defines the high-level flow of execution for a
test executive
• The TestStand default process model is a sequence file called
SequentialModel.seq
• Workspaces, projects, and source code control features help
provide ways to better manage your test files and structure
• The TestStand Differ enables you to make changes to and
compare sequence files
Summary
This lesson discussed the basic components of the TestStand environment: sequences, step groups,
and process models.
In a sense, you can think of TestStand as providing fully customizable “templates” for every aspect
of testing. There is a default template available for the process itself, TestStandModel.seq, and
a default order for sequences: setup, main, and cleanup. These templates should work for the
majority of test environments, but as you work through the exercises in this course, you will see
that you can easily modify each “template” to suit your particular needs.
Taking a top down perspective, a process model consists of a particular ordering of sequences and
callbacks which match a testing process. The sequences themselves consist of a group of steps. The
groups are, in turn, made up of steps configured by test developers. These steps correspond to a
wide variety of actions, including testing a UUT, message popup for status, and so on. The next
lesson discusses how these individual steps are configured to create sequences.
5. Use the View Ring to toggle between different sequences in the same
sequence menu.
The Main, Setup, and Cleanup tabs each show one step group in the
sequence. To view the contents of each tab, click the tab. The steps you
insert in each step group have the following purposes:
• Main: Test the UUT.
• Setup: Initialize or configure instruments, fixtures, and the UUT.
• Cleanup: Power down or reset instruments, fixtures, and the UUT.
The Main group contains the bulk of the steps in a sequence, typically the
steps that test the UUT. In this sequence, the Main group contains all steps
that test the UUT, such as Powerup Test, ROM Test, RAM Test, and so on.
The Setup group contains steps that initialize or configure the test system.
In this sequence, the Setup group contains the Simulation Dialog step that
displays the dialog box used to select which computer components should
fail. It also contains a step to turn on a simulated vacuum table for testing
each UUT.
The Cleanup group contains steps that power down or deinitialize the
instruments, fixtures, and UUT. In this sequence, the Cleanup group
contains a step for powering down a simulated vacuum table that was turned
on in the Setup group.
Move the Speed slider toward Slow, which introduces a delay while tracing.
3. Click the Run button. This executes the sequence in Test UUTs mode
and brings up the familiar UUT information dialog box. Enter any
number and click OK.
Run button
4. The execution pauses at the first breakpoint—in this case, the CPU
Test. Notice that the step into, step over, and step out of buttons in the
toolbar are activated.
Click the step into button. The execution pauses at the first test in the
CPU subsequence. Click on the step over button to stop on the next test.
5. The Run button is now the Resume button. Click on the Resume button
to continue executing to the next breakpoint.
Resume button
Note These same debugging options are available in the operator interfaces. However,
these tools will appear under menus rather than as task bar buttons.
End of Part A
Note You can invoke the watch window only while the execution is running. Therefore,
you should place a breakpoint in a sequence file before it begins running if there are
variables or expressions to watch while debugging the file.
4. Click the variable named PowerFail and click the Insert button.
Then click OK to insert this variable into the watch window. The watch
window should now resemble the following screen.
End of Part B
Testing a Unit Under Test (UUT) requires more than just executing a set of
tests. Typically, the test executive must perform a series of operations before
and after it executes the sequence that performs the actual tests. Common
operations include identifying the UUT, notifying the operator of pass/fail
status, generating a test report, and logging results. These operations define
the testing process. This set of operations and their flow of execution is
called a process model. Having a process model is essential so that you can
write different test sequences without repeating standard testing operations
in each sequence.
4. Single step through the sequence by clicking the Step Over button in the
toolbar or selecting Debug»Step Over. Continue to single step until the
sequence completes execution.
Notice that only the steps in the MainSequence of the Ex 2-3
Computer Motherboard Test.seq were executed. No additional
steps were run and no report was generated.
4. Set a breakpoint on the first step of the Single Pass sequence by clicking
to the left of the step or right-clicking on the step and selecting Toggle
Breakpoint from the pop-up menu. A small red stop button to the left
of the step indicates a breakpoint.
5. Return to the Ex 2-3 Computer Motherboard Test.seq sequence
window by clicking on it or selecting it from the Window menu. Select
Execute»Single Pass. The execution window appears and immediately
pauses on the Check for Proper Use step of the Single Pass sequence.
Click the Step Over button in the toolbar or select Debug»Step Over
until the sequence is paused with the execution pointer on the
MainSequence Callback step. Click the Step Into button or select
Debug»Step Into to step into the main sequence. Notice that the
execution has now proceeded to the steps of the Ex 2-3 Computer
Motherboard Test.seq sequence. Step over several of the steps and
then click the Step Out button or select Debug»Step Out to return to
the process model sequence. Notice that the sequence execution has now
returned to the steps of the Single Pass sequence. Resume normal
execution by clicking on the Resume button in the toolbar or selecting
Debug»Resume. You may want to remove the breakpoint before
continuing with the execution but this is not necessary.
6. Close the execution window and all sequence windows.
Notes
Notes
Lesson 3:
Creating Sequences
Introduction
This lesson describes the steps involved in creating a TestStand sequence. You will learn how to
create a new TestStand sequence, specify the test modules for each step, and configure the step
properties.
Adapters are the interfaces between TestStand and the external application development
environment (ADE) in which you can write test modules. Each external language or type of
compiled file supported by TestStand has its own adapter. Currently, TestStand has seven adapters:
• DLL Flexible Prototype Adapter—Calls Dynamic Linked Libraries (DLLs)
• C/CVI Standard Prototype Adapter—Calls LabWindows/CVI source and object files
• LabVIEW Standard Prototype Adapter—Calls LabVIEW VIs
• Automation Adapter—Calls ActiveX Automation servers
• HTBasic Adapter—Calls HTBasic subroutines
• Sequence Adapter—Calls subsequences
• <None> Adapter—Creates a step that does not call a test module
Tests are steps for testing UUTs and making pass/fail determinations. There are four built-in test
types in TestStand. Each test type has different associated data and properties.
• Pass/Fail Test: The test module passes a Boolean value (True or False) to determine if the
step passes or fails.
• Numeric Limit Test: The test module passes a numeric value, which is compared to high and
low limits in TestStand.
• MultiNumeric Limit Test: The test module passes multiple numeric values, which are
compared to sets of high and low limits.
• String Value Test: The test module passes a string, which is compared to an expected string
in TestStand.
Actions are steps that perform operations (for example, initializing an instrument). They do not
pass result data back to TestStand, but instead either execute their operation successfully or
generate a run-time error.
Step Types
Numeric limit test Property Loader User-defined
• Measured value Database: step type
• Limits (H, L) • Open/Close Database
String limit test • Open/Close SQL Statement
• Data Operations
• Returned String
• Comparison String Synchronization:
• Lock
Pass/fail test • Semaphore
• Result (T/F) • Rendezvous
• Queue
Action • Notification
• Wait
Sequence call • Thread Priority
Label • Batch Synchronization
• Batch Specification
Statement IVI:
Goto • Dmm
• Scope
Message popup • Fgen
• Tools
Step Types
• Sequence Call—Calls another sequence (which is considered a subsequence of the calling
sequence).
• Statement—Evaluates an expression or sets values of TestStand variables.
• Message Popup—Displays a run-time message in a pop-up dialog box.
• Call Executable—Allows .exe files to be executed from TestStand.
• Property Loader—Allows for dynamic limit/property loading from a file or database. The
property loader step is discussed in more detail in Lesson 10.
• Goto—Branches to another step in the sequence.
• Label—For documentation purposes in the sequence and useful as a target for a Goto step.
• Database—Enables you to manipulate data in tables.
• Synchronization—Enables you to synchronize multiple threads of sequence execution from
within a sequence.
• IVI—Enables you to easily configure and acquire data from IVI class compliant instruments.
TestStand allows you to copy step types and modify their properties to suit your needs. Modifying
and creating custom step types is discussed in the TestStand II course.
Test Modules
Sequence
LabVIEW VI
Step 1
Step 2
CVI code
Step 3
Although each step can call only one module, multiple steps can call the same module.
To specify a test module for a step, right-click on the step and select Specify Module from the
pop-up menu. In the dialog box that appears, enter information such as where the test module is
located or what type of data to pass to it. Each adapter has a separate Specify Module dialog box.
The Edit LabVIEW VI Call dialog box is shown on the next slide.
Edit LabVIEW VI
Call Dialog Box
Notice that when you add a directory to the list of search directories you have the option of
including its subdirectories in the search.
If the path to the module is not in a subdirectory of a configured search directory then you are given
two options: add the directory of the module to the list of search directories or reference the module
in an absolute path.
If the module is located in a subdirectory of a configured search directory but the option Search
Subdirectories was not enabled for that directory, you are given the additional option to reference
the module using a path relative to the search directory.
Access a step’s properties by right-clicking on the step and selecting Properties, which launches
the Properties dialog box. The next section introduces each Properties dialog box, which is
described in greater detail in Exercise 3-1.
The General tab has command buttons that vary according to the step type. For example, a Numeric
Limit test has an Edit Limits button to modify the step limits, while a String Value test has an Edit
Expected String button to specify the desired string for comparison with the step results.
Use the Specify Module button to launch a dialog box for specifying a code module (or sequence)
for the step and values to pass as arguments to the code module. (This dialog box is the same one
you see when you right-click on a step and select Specify Module.) Each adapter has a unique
dialog box to obtain the information the adapter needs.
The main window, Preconditions for <test>, displays the conditions that must be true for the
current step to execute. You can organize several precondition statements by using AnyOf or AllOf
(Boolean OR and AND statements, respectively).
Use the Edit/View Expression section to create your own expressions or to view expressions
entered from the main window.
Use the Insert Step Status section to build precondition expressions for display in the main window,
such as Insert Step Pass (the current step does not execute unless a specified step passes), Insert
Step Fail (the current step does not execute unless a specified step fails), Insert Step Error (the
current step does not execute unless an error has occurred), and Insert Step Executed (the current
step does not execute unless a particular step has run, regardless of whether it passed or failed).
Note Execution time refers here to the time for the entire test sequence(s) to complete.
The Precondition Evaluation in Interactive Mode ring control contains the following items:
• Use Station Option—Uses current station option. Configure»Station Options determines
whether to evaluate the precondition in interactive mode.
• Evaluate Precondition—Always evaluates the precondition for the step when running in
interactive mode.
• Do Not Evaluate Precondition—Does not evaluate the precondition for the step when running
in interactive mode.
For example, for a numeric limit step, the default status expression compares the result returned
from the test module with high and low limits to determine whether the step’s status is “Passed”
or “Failed” using the comparison criteria you selected.
Exercise 3-1
Exercise 3-2
The Multithreading and Remote Execution section contains the following options:
• None—Executes the subsequence within the same thread and execution as the calling
sequence.
• Run Sequence in New Thread—Executes the subsequence in a new thread within the same
execution. This allows the subsequence to run asynchronous to the calling sequence.
• Run Sequence in a New Execution—Allows TestStand to launch the subsequence in a new
execution that runs in parallel to the calling sequence execution. The subsequence can also be
launched in a new execution of an execution entry point, i.e. Test UUTs or Single Pass, within
the specifed process model.
• Run Sequence on a Remote Computer—Executes the specifed subsequence on a remote
computer located on the network. The results of the subsequence will be returned to the calling
sequence located on the client computer.
Ensure that you have a logical name “SampleScope” installed on your computer. For more
information about logical names and IVI please refer to the Appendix A of this course.
1. Open C:\Exercises\TestStand I\IVIExample.seq.
2. Ensure that your report options are set to “Insert Graph” and report type are set to HTML.
3. Select Execute»Single Pass to execute the sequence.
4. You will see a dialog which displays the waveform as shown above.
5. Close the dialog and you will see a report which displays the waveform and also gives you the
frequency estimate of the the wave. You will need the complete IVI driver toolset installed on
your computer to change the frequency.
Exercise 3-3
Lesson 3 Summary:
Creating Sequences
• Use the Sequence Editor to edit and build
sequences
• There are four actions to add a step to a
sequence:
1) Specify the adapter
2) Select the step type
3) Specify the test module
4) Configure the step properties
In this lesson, you learned about the basic building blocks for building a sequence: specifying an
adapter, selecting a step type, specifying the test module, and configuring the step properties.
Your decision for choosing an adapter is based on the programming environment in which you
develop your tests. Notice that TestStand provides you with the flexibility of using different
adapters for each step. Through this adapter interface, you can quickly port existing test code to
TestStand.
TestStand provides you with a variety of built-in steps. Remember that there are three step groups
in each sequence: setup, main, and cleanup.
Specifying the test module allows you to select an existing test module or, as you will later learn,
you can build a new module starting from a code template.
Finally, after you add a step to a sequence, you configure the step’s properties. By configuring the
step properties, you can specify a wide range of behaviors, such as skipping the step (Run Options),
executing the step only under certain conditions (Preconditions), looping on the same step a fixed
number of times or until a condition occurs (Loop Options), performing an action after the step
completes (Post Action), or initializing or computing a value before or after the step runs
(Expressions).
The Step Properties dialog box contains several options for configuring
the step, including:
• When to load the step
• What conditions will cause the step to execute
• What information TestStand examines to determine whether a test
passes or fails
• Whether TestStand executes the step in a loop
• Ways to sychronize the step with other executions
6. Click on the Specify Module button. This brings up the Edit DLL Call
dialog box. Click the Browse button and select the file Dllfuncs.dll
from the CVI Project Files directory, for the DLL Pathname.
Click OK to select this file.
A dialog box may appear with options for the file path. Choose the
option to use a relative path for the file you selected, so that the path
to the code source is stored relative to the sequence file. Click OK to
return to the Edit DLL Call dialog box.
Select the StartBeep function. All functions exported from the DLL are
listed under the Function Name Control. For this exercise, only the
StartBeep and StopBeep functions are used (the process for adding a
step for the StopBeep function is described later).
Select the Edit Prototype option and set the values as shown below. The
tone parameter sets the beep frequency, which is 1000 Hz in this case.
Note You must build a DLL with a type library for the function prototypes to appear in
the Function Prototype tab at the bottom of the dialog box and for all parameters to
appear in the Parameter menu ring. To create a type library in LabWindows/CVI, you
must create a Function Panel file first.
Do not run the sequence until all the steps in this exercise have been
completed. Click OK to close the Edit DLL Call dialog box.
7. Click the Preconditions button to open the Preconditions Editor.
A precondition specifies the conditions that must be true for TestStand
to execute a step during the normal flow of execution in a sequence.
For example, you might want to run a step only if a previous step passes.
In this case, this step should execute only if the ROM test fails.
For this exercise, click the ROM Test in the Insert Step Status section.
Click the Insert Step Fail button. This inserts the condition that the
AlarmStart step executes only if the ROM test fails. Notice that other
options for conditions include running the current step only if another
test passed, caused an error, or has executed. It is also possible to create
expressions that can be evaluated and used as conditions for executing a
step. Inserting more than one precondition and the use of TestStand
expressions are discussed later in this course.
After entering the preconditions, click OK to finish.
8. After setting the step’s preconditions, configure and examine other step
properties.
If the AlarmStart Action Properties dialog box is closed, open it by
double-clicking on the Alarm Start step in the sequence window. Click
the Run Options tab to examine the run options and ensure that Run
Mode is Normal, with the step results recorded in the report. Examine
the other Load, Unload, Run, Precondition Evaluation, and Window
Activation options. Ensure that the settings are as shown below before
continuing.
• Skip—TestStand does not execute the step and does not evaluate its
preconditions. Instead, TestStand sets the status of the step to
SKIPPED automatically.
• Normal—TestStand executes the step normally. This is the default
value.
9. Click the Post Actions tab, as shown below.
The Post Actions tab specifies an action that occurs after a step executes. In
the case of a step that is specified as an Action step such as the StartBeep
step, the only post action option for the step is to use the Custom Condition
option since an Action step does not “Pass” or “Fail”. For other types of test
steps the post action can be conditional on the pass/fail status of the step or
any custom condition expression. For example, you may want to jump to a
particular step in the sequence if this step fails. By default, the On Pass and
On Fail actions are “goto next step.” Review the other available options,
ensuring that the final options are configured as shown above.
You can use the Loop Options tab to configure an individual step to run
repeatedly in a loop when it executes. In this case, configure the step to
loop 25 times and record the results of each iteration. Ensure that the
settings are the same as shown above.
Notice that as changes are made in this window, TestStand automatically
builds an expression in the Loop While Expression and Loop Status
Expression controls. An expression is a formula that TestStand evaluates
to obtain a new value from the values of multiple variables or properties.
Expressions are discussed further in the next lesson.
The step runs 25 times, and the step returns a FAILED status if any
iteration fails. This is determined by the loop result, which is Fail if less
than 100 percent of the iterations pass.
Click OK to close the AlarmStart Properties dialog box. The sequence
file should now be the active window.
3. In this step, random numbers returned from the test module are tested.
The random numbers lie between 0 and 1. The test results are limit
checked, and if the value is less than 0.5, indicating a failure, the step
repeats.
The other options in the Specify Module dialog box are discussed later
in the course. Click OK when finished.
4. Right-click on the step again and select Edit Limits. Set the limits as
shown below. This indicates a Failure if the returned measurement
(random number) is less than 0.5 and a Pass if it is greater than or equal
to 0.5.
5. Set the loop options so that the step loops five times or until the test
passes. Right-click on the step again, and this time select Properties.
Click the Loop Options tab and set the loop options as shown below.
6. The sequence is now set up to run as desired. Run the sequence several
times and examine the report each time. The report should look similar
to the report shown on the next page.
Note The report is arranged to display a summary about the execution before displaying
information about each loop iteration. If the RandomNumber step had been the third step,
it would be the third item listed in the report and would be followed by the results of the
fourth step. For example, in the test report shown on the next page, the RandomNumber
step eventually passed. Notice that the first “RandomNumber” in the report contains
more information than the others, including the number of passes, failures, and the total
number of iterations of the step. Because the RandomNumber step had looping options
set, the next item in the report is the result of each iteration of the loop. After the results
of each iteration of the loop are reported, the report lists the results of the fourth step.
7. Save the finished sequence file before moving on to the next exercise.
Note The step and sequence to be called do not need to have the same name. However,
for this exercise it is easier to remember the sequence name if the step name is the same.
3. Click in the View Ring and select the All Sequence view as shown.
4. Notice that there is currently not a sequence named CPU Test in this
sequence file. You can create this sequence in this sequence file by
right-clicking in the window and selecting Insert Sequence as shown.
10. A dialog box may appear with options for the file path. Choose the
option to use a relative path for the file you selected, so that the path
to the code source is stored relative to the sequence file. Click OK to
return to the Edit LabVIEW VI Call dialog box.
12. Click the Main tab to switch from the Setup step group window to the
Main step group window. Right-click in the sequence display window
and select Insert Step»Tests»Pass/Fail Test. Rename the step
Register Test.
13. Repeat step 12 three more times to create the Instruction Set
Test, Cache Test, and FPU Test steps, as shown below.
15. Click OK to return to the Edit LabVIEW VI Call dialog box. Choose the
option to pass the Sequence Context ActiveX Pointer as a parameter
to the VI. The dialog box should resemble the one shown below.
16. Repeat all of steps 14 and 15 for the Instruction Set Test step,
except select Instruction Set Test.vi.
17. Repeat all of step 14 and 15 for the Cache Test step, except select
Cache Test.vi.
18. Repeat all of step 14 and 15 for the FPU Test step, except select FPU
Test.vi. The finished screen is shown below. The name of the resource
being called at each step appears in the Descriptions column in the right
window pane.
19. Click on the Parameters tab. Right-click in the right window pane and
select Insert Parameter»Boolean to create a Boolean parameter that is
passed into this sequence when it is called as a subsequence. Parameters
are discussed in greater detail in Lesson 4.
20. Rename this parameter CPUFail. Save the sequence and use the View
Ring to select the MainSequence sequence again.
21. Click the Main tab to view the Main step group window of the
MainSequence. Right-click on the CPU Test step and select Specify
Module to select which sequence should be called at this step. In the
resulting dialog box, click the Use Current File option and select the
sequence CPU Test from the Sequence Ring as shown.
The CPU Test sequence created during this exercise has been selected
as the sequence to be called at this step. Remember that this sequence
requires a parameter called CPUFail to be passed to it. Notice that when
you select the CPU Test sequence, the CPUFail parameter is
automatically added to the list of parameters to be passed to the
sequence. This is because the Use Prototype of Selected Sequence
option is checked.
22. You still need to specify the value for this parameter. Click the Browse
button to launch the expression browser. In the expression browser, click
the + sign next to “Locals” and then click the CPUFail variable. Click
Insert to select that expression as the value to be passed.
23. Click OK to return to the Edit Sequence Call dialog box, which should
now resemble the following screen.
24. Click OK to return to the sequence file window. Run the sequence file
by clicking the Run button. The report now contains a section to report
that the sequence CPU Test was run. Additionally, another section lists
the results of each of the four tests created in this exercise. Close the
report, but leave the sequence file open for the next part of this exercise.
End of Part A
8. Right-click on the Cache Test step and select Specify Module from
the menu. Click Browse and select the code module,
C:\Exercises\TestStand I\CVI Project Files\Computer
dll.dll. Click OK to proceed to the Edit DLL Call dialog box.
9. Select the function Cache Test from the Function Name Ring.
10. Select the first parameter, seqContextCVI, and fill in the following
information:
Parameter: seqContextCVI
Value Expression: ThisContext
11. Select the result parameter and fill in the following information:
Parameter: result
Value Expression: Step.Result.PassFail
Result Action: No Action
12. Select the errorOccurred parameter and fill in the following
information:
Parameter: errorOccurred
Value Expression: Step.Result.Error.Occurred
Result Action: No Action
13. Select the errorCode parameter and fill in the following information:
Parameter: errorCode
Value Expression: Step.Result.Error.Code
Result Action: No Action
14. Select the errorMsg parameter and fill in the following information:
Parameter: errorMsg
Value Expression: Step.Result.Error.Msg
The resulting dialog box should resemble the one shown below.
The Function Call tab at the bottom of the screen contains the actual
function call. Click OK to exit the Edit DLL Call dialog.
15. Select the MainSequence from the View Selector Ring. Save the
sequence and run it by clicking the Run button. The sequence file
should execute the same as before, and the report should be identical
also. The only difference is that two of the steps in the CPU Test
subsequence are now calling DLLs using different adapter types, instead
of calling LabVIEW VIs using the LabVIEW adapter. When the
exercise is complete, close the sequence file.
End of Part B
This exercise introduced the C/CVI Standard Prototype Adapter. Both the
C/CVI Standard Prototype Adapter and the DLL Flexible Prototype Adapter
can call DLLs, but they use different methods to call these code modules.
This discussion compares these two adapter types and describes the benefits
of each.
When developing new tests, C/C++ users must decide whether to use the
C/CVI Standard Prototype Adapter or the DLL Flexible Prototype Adapter.
Each adapter has advantages. Use the adapter that best suits your particular
needs.
The C/CVI Standard Prototype Adapter uses a standard prototype, while the
DLL Flexible Prototype allows a choice of various function prototypes. The
DLL Flexible Prototype Adapter gives you more flexibility when you define
your test functions. You can pass any number of arguments directly to a test
function. This makes it convenient to access TestStand variables or
properties in the function. Of course, you can always use the TestStand API
to access TestStand variables and properties from test functions that you call
with either adapter.
The C/CVI Standard Prototype Adapter also allows you to use object files,
static libraries, and C source files (in LabWindows/CVI). In addition, the
C/CVI Standard Prototype Adapter has tighter integration with the
LabWindows/CVI environment for creating and editing code. Finally, the
C/CVI Standard Prototype Adapter uses a fixed prototype to which it passes
a predefined set of parameters. You do not need to specify the argument
values to pass to your test functions.
When making your decision, keep in mind that it might be difficult to switch
from one adapter to the other once you start test and sequence development.
End of Exercise 3-3
Note For this exercise, be sure to select the Execute»Tracing Enabled option or select
Configure»Station Options and adjust the slider on the Execution tab. When this option
is enabled, the sequence execution includes yellow arrows indicating the current
sequence execution step. When this option is not enabled, there are no visible markers to
indicate the current step being executed in any sequence execution window.
2. Set the sequence display window so that multiple windows are viewable
in the Sequence Editor.
3. Click the Run button and notice that the sequence begins executing and
continues running when it reaches the end of the sequence file.
5. Click the Run button again and notice that a second execution window
opens. Notice that the two sequence executions are both running and are
executing independently from one another. Click the Run button several
more times and notice that you can run many executions simultaneously
and independently from one another.
6. Because this sequence has no built-in way to stop itself, you may stop
the sequence execution by clicking the X button in the top right corner
of the execution window or selecting Terminate All Executions under
the debug menu. When you click this button, the following dialog box
appears. Select the option to Terminate Execution. This allows
TestStand to halt the execution cleanly and run any cleanup steps for the
executing sequence. Repeat this process for each sequence execution.
Notes
Introduction
One of the most powerful TestStand features is its flexible framework for sharing data. In this
lesson, you will learn about TestStand parameters and the three types of TestStand variables: locals,
sequence file globals, and station globals. You will also learn about runstate properties and how to
utilize the TestStand Expression Browser to use variables and properties in expressions throughout
the TestStand environment.
TestStand Variables
One of the most important functions that test executive software provides is a method for sharing
data among tests and sequences. In TestStand, there are three different types of variables for sharing
data collected by tests. The three variable types differ only in their scope, or where they can be
accessed.
• Parameters—Used only within a sequence to pass data between subsequences and the calling
sequence. A subsequence is a sequence called as a step from within another sequence (that is,
the calling sequence).
• Local Variables—Share data within a single sequence file between the steps of a sequence.
• File Global Variables—Share data between multiple sequences within a single sequence file;
share data between steps of the sequences within that sequence file.
• Station Globals—Share data between multiple sequence files. Station globals are defined for
a particular installation of TestStand, and any sequence files running on the station can access
them.
TestStand Parameters
• Directly pass data between calling sequence and
subsequence
• Define in Parameters tab of sequence display
window
Sequence File
Subsequence 1
Parameter 1
Calling Sequence Parameter 2
Data 1
Data 2 Subsequence 2
Parameter 1
Parameter 2
Parameters
Sequences may have parameters for passing data from one sequence to another. In LabVIEW, using
parameters with sequences in TestStand is analogous to passing data between VIs using connectors
in the block diagram of the top level VI. For LabWindows/CVI, using parameters in TestStand is
analogous to passing data through function parameters. To create parameters in the sequence
display window, use the Parameters tab and select the desired data type. Any step within the
sequence can then access (read or write) the parameters.
Parameters are typically used to pass data between top-level sequences and subsequences. Identify
subsequence parameters and specify their values in the Edit Sequence Call dialog box, which
appears when you insert a Sequence Call step into a sequence and specify the module. The Edit
Sequence Call dialog box is shown on the next slide.
Parameters:
Passing data to subsequences
Local Variables
• Share data among all steps in a sequence
• Access using expressions and/or test
modules
Sequence A
Step 1
Seq A
Locals
Step 2
Local Variables
Local variables are shared within a single sequence. All sequence steps can get (read) or set (write)
the value of the local variables defined for a sequence. The value of a local variable can be read or
written in any TestStand expression associated with steps in that sequence, or in any of the test
modules called by those steps. Thus, each sequence has its own set of local variables.
For example, you can store a local variable called Serial Number at the beginning of the sequence,
and then retrieve this serial number in subsequent tests to help you decide which specific tests
to run.
Exercise 4-1
Step 1
Seq A
Locals
Step 2
Sequence File
Globals
Sequence B
Step 1
Seq B
Locals
Step 2
Station Globals
Station globals have the largest scope: they share data
between multiple sequence files
Sequence File A
Sequence A
Seq A
Step 1 Step 2 Locals Seq File
Globals
Sequence B Seq B
Step 1 Step 2 Locals
Station Globals
Sequence File B
Sequence A
Seq A
Step 1 Step 2 Locals Seq File
Globals
Sequence B Seq B
Step 1 Step 2 Locals
Station Globals
Station globals have a larger usability scope than either locals or sequence file globals. They pass
data between different sequence files. Station globals are defined for a particular test station and
their values are written to StationGlobals.ini each time the Sequence Editor is closed. This
enables TestStand to keep track of data values even when it is shut down. This allows users to save
state information, such as the last operator to run a test.
The values of station global variables are persistent across different executions and even across
different invocations of the Sequence Editor or run-time operator interfaces. In addition, the
TestStand API includes an ActiveX method that may be called to update StationGlobals.ini
explicitly.
The RunState property object contains many subproperties. Some of these are listed below with
a brief description:
• Engine—Engine object in which the sequence invocation executes
• Root—Sequence context for the root sequence invocation
• Main—Sequence context for the least nested sequence that is not in a process model
• ThisContext—Reference to the current sequence context
• Caller—Sequence context for the sequence that called the current sequence
• Report—Report object for the execution
• Execution—Execution object in which the sequence invocation runs
• Sequence—Run-time copy of the Sequence object for the sequence invocation
• Thread—Thread object in which the sequence invocation executes
RunState Subproperties
Empty Filled
RunState Subproperties
It is important to note that some of the properties listed under the RunState property object are
empty when a sequence is not being executed. To find which subproperties are available when a
sequence is not being executed, select View»Browse Sequence Context from the menu and
expand the RunState property object. The majority of the RunState subproperties will be listed
at this time. However, some of the subproperties that are containers will not contain any
information, such as the Root, Main, Caller, and Execution properties.
To view which RunState subproperties are available during a sequence execution and what
information is contained in these properties, place a breakpoint on a step within the sequence.
Execute the sequence and when TestStand reaches the breakpoint, select the Context tab from the
execution display. Expand the RunState property object to view the available properties
according to the current sequence invocation.
An expression is a formula that calculates a new value from the values of multiple variables or
properties. You can use TestStand expressions to evaluate a value in place of hardcoding a value
for a simple variable or property value. Throughout the Sequence Editor, there are locations (input
controls) where you can create a custom expression for evaluation purposes during sequence
execution. This is possible from many locations such as the Post Actions, Loop Options, and
Expressions property tabs, and also from within the Statement, Limit Loader, and Message Popup
steps.
You can enter an expression in any TestStand control that has a Browse button beside it. Clicking
on this button brings up the expression browser, which is a tool for building your expressions, and
is especially useful for the novice user. You can also launch the Variable Browser by selecting
View»Browse Sequence Context. This browser is similar to the expression browser, except the
functions and operators do not appear. Although it is not necessary to use the expression browser
to enter an expression, it is useful for locating variables and functions when building complex
statements. The next slide shows how to use the expression browser features.
There are terms you should understand as you develop more complex TestStand sequences using
the Expression Browser:
• SequenceContext—Contains references to all global variables, local variables, and step
properties in active sequences. The sequence context contents change depending on the
currently executing sequence and step.
• ThisContext—Refers to the current sequence context. You usually use this property to pass the
entire sequence context as an argument to another sequence or a step module. Sequence
contexts are ActiveX Automation reference handles you can use in conjunction with test
modules.
• RunState—Contains properties that describe the state of execution in the sequence invocation.
Exercise 4-2
Exercise 4-3
Exercise 4-4
Exercise 4-5
Lesson 4 Summary:
Parameters, Variables, & Expressions
• TestStand has different scopes for data sharing
– Parameters share data between calling sequences and
subsequences
– Local variables share data between steps in a sequence
– Global variables share data between all sequences within a
sequence file
– Station globals share data between all sequence files within
the TestStand environment
• RunState Properties describe the state of execution
• The Expression Browser is a tool for building
expressions and can also be used to define variables
and parameters
Summary
In this lesson, you learned how to share data within the TestStand environment. Each method for
sharing data serves a particular purpose. You may want to think about which situations would
require the use of parameters, locals, sequence file globals, or station globals. For example, as you
begin deployment onto the production floor, what information on the test station is needed across
shifts? If you have a DLL, should all the data manipulation be internalized or shared using
sequence locals?
As you access and modify variables, you may also want to make use of the RunState properties for
information such as the UUT serial number, the UUT loop index, and the next step index. Using
multiple variables and properties in your expression can create complex statements. TestStand
eases this task by allowing you to create arbitrarily complex expressions through the Expression
Browser. It also improves programming efficiency by allowing you to define variables and
parameters from within the Expression Browser.
Now that you have learned the basics of the TestStand sequence editor, the next lesson will discuss
how test programs from external development environments interact with TestStand.
2. Name the local variable Frequency. This variable sets the audible
alarm tone when the ROM Test fails.
3. Click on the Main tab. You must change the module called during the
ROM Test step at this point. Right-click on the ROM Test and
select Specify Module. Click on the Browse button to select the VI,
C:\Exercises\TestStand I\VIs\ROM Test - Local
Variable.vi. Remember to select a relative path when TestStand
prompts for how the path should be stored. Select the Show VI front
panel when called and Sequence Context ActiveX Pointer options.
The screen should appear as shown below.
Note Failing to select the Show VI Front Panel When Called option may lead to an
infinite loop running in the VI.
Note If you are not familiar with National Instruments LabVIEW programming
environment, skip to step 4.
Click the Edit VI button on this screen to edit the VI. Observe that the
front panel has a frequency control for entering the frequency value.
Go to the block diagram and observe that the frequency value is passed
to TestStand using the TestStand Automation VIs. The main VI to notice
in this diagram is TestStand - Set Property Value(number).vi,
because it passes the numeric value into TestStand. These VIs and their
functions are covered in greater detail later in the course. Close the VI.
4. Edit the StartBeep step to set the tone using the Frequency local
variable.
Right-click on the StartBeep step and select Specify Module. In the
Parameters section, delete the constant value of 1000 in the Value
Expression control. Press the Browse button and choose
Locals.Frequency. Click Insert and then OK. The Edit DLL Call
dialog box should now have Locals.Frequency set as the value for
the parameter Tone. Select OK to return to the sequence display
window.
This creates a numeric local variable. Name the local variable LocalA.
5. Select File»New Sequence File to create a new sequence file and create
another local variable by repeating steps 1 through 4 above. Name this
local variable LocalB and the sequence file Ex 4-2 All
Variables2.seq. You should see the panel shown below.
8. Click on the View ring and select TestSequence to view the contents of
this sequence.
9. Select the menu option View»Browse Sequence Context. Notice that
LocalB is not available for use in this sequence, as shown. This is
because LocalB was defined in the MainSequence and not in the
TestSequence.
Note Although the two sequences are in the same sequence file, the local variables are
not shared between them.
Click Close to exit the dialog. Leave this sequence file open for the next
part of this exercise.
End of Part A
4. Click Close to return to the Sequence Editor. Use the View Selector to
select the MainSequence. Select View»Browse Sequence Context
and notice that the TestFileGlobalA variable is available for use in
this sequence also.
Therefore, the data in the file global you created in MainSequence is
available for use in all other sequences in the Ex 4-2 All
Variables2.seq sequence file. In this way, you can use sequence file
End of Part B
beside the station global called TS and notice that this container holds a
value called LastUserName. This variable is the name of the last user
that logged into TestStand and it is being stored as a station global
variable. LastUserName is stored in a station global variable because
when the Sequence Editor is launched, the user name from the previous
session is displayed in the Login dialog box.
End of Part C
Part A
1. Open and run Ex 4-3 Using Expressions to Change Step
Properties.seq. Notice that the Video Test always fails. This step
fails because the returned Measurement is outside the specified limits
of 15 and 19. Observe the report as shown below.
used to set the desired comparison type and the input limits used in the
comparison.
4. Place your cursor in the Pre Expression control. Click the Browse
button for the Pre Expression control (the top button). This opens the
expression browser, as shown below.
5. Click the + sign beside Step and notice that all Video Test step
properties are displayed. As shown below, you can use the expression
Step.Limits.Low to access the low limit of the Video Test step.
Click the + sign beside Limits to display the Low and High limit
properties as shown below. After selecting the Low property, click the
Insert button.
Place the cursor after Step.Limits.Low and enter = 2, to set the low
limit to a value of 2. Next you will specify the value for the high limit.
A comma is needed to separate multiple expressions, so be sure to
include it in the expression box after the first expression.
6. Click High and the Insert button again. Place your cursor after
Step.Limits.High and enter = 12 to set the high limits, as shown
below. Click OK to close the Expression Browser.
End of Part A
3. Right-click on the RAM Test step and insert a new Statement step.
Statement steps are useful for manipulating expressions. Name this step
Modify Video Limits, as shown below.
5. Go to RunState.Sequence.Main[“Video Test”].
Limits.High and click on Insert again. Place your cursor at the end
of that line and enter = 12. Click Check Syntax to make sure there are
no syntax errors and then click OK to return to the Edit Statement Step
dialog box and ensure that it appears as shown below.
Click OK to return to the Sequence File. Run the sequence file using
Single Pass to make sure that it works correctly. Close the sequence file
when finished with the exercise.
End of Part B
The Configure Message Box Setup dialog box should resemble the
following screen.
11. Enter the remainder of the expression in the Post Expression control by
either using the Expression Browser or typing in directly:
Locals.CPUType = ((Step.Result.ButtonHit == 2)?
"AMD": "INTEL")
This expression assigns the string value "AMD" or "INTEL" to the local
variable, depending on which button the user clicks.
Button 1 "1"
Button 2 "2"
Button 3 "3"
Button 4 "4"
17. Click OK to close the Configure Message Box Step dialog box.
18. Right-click on the Specify Number of CPUs step and select the
Insert Step»Sequence Call command in the context menu.
19. Rename the step CPU Test.
20. Right-click on the new CPU Test step and select Specify Module from
the context menu.
21. Enable the Specify Expressions for Pathname and Sequence option.
This option allows an expression to determine the name of the sequence
file to be called. By default, TestStand expects the name and path of the
sequence file to be typed in, but by enabling this option, TestStand
evaluates an expression to determine the path and filename for the
sequence to be called at this step.
Also, enable the Use Current File option. This option specifies the
current sequence file as the location for the subsequence call to look.
Because both subsequences that can be called are in the same sequence
file as “MainSequence,” you should select this option. The only thing
that needs to be selected is the name of the Sequence to be called within
the sequence file.
22. Enter the following value for the Sequence Expression control:
34. Click OK to close the dialog box. The value to be passed to the
subsequence has been assigned. The sequence can now decide which
subsequence to call and what values to pass to the subsequence as
parameters. Notice that because the value is passed using a parameter,
there is no need to create a file global or station global variable.
35. The finished sequence file should resemble the following screen.
Select File»Save to save the Ex 4-4 Passing Parameters.seq
sequence file.
End of Part A
7. Click on the Context tab and notice the values of the two parameters for
the sequence, as shown below.
End of Part B
You will learn how to dynamically select a sequence file to run. Open the
sequence file C:\Exercises\TestStand I\Ex 4-5 Dynamically
Selecting Which Sequence to Run.seq. The MainSequence
contains three steps: Generic Processor, Intel Processor, and AMD
Processor. In this exercise your goals are to:
1. Add a step that asks the user to select the type of processor to test.
2. Make the necessary changes to ensure that the selected processor is
tested.
Hints:
Use a Message Popup step to ask the user which type of processor to test.
The Message Popup step stores the selected button in:
RunState.Sequence.Main[Name of the Message Popup
step].Result.ButtonHit.
Notes
Notes
Introduction
In this lesson, you will learn how to create test modules in external environments for use in
TestStand, and how data is transferred from TestStand to other environments. You will also
examine the LabVIEW and LabWindows/CVI test development environments, learn how to pass
data to TestStand from these environments, and debug these code modules directly from TestStand.
From the test module, data is passed into these structures. TestStand uses this information to
perform operations such as error handling or result collection. This is the same method used in
prior versions of the Test Executive Toolkits, making it possible for TestStand to call tests written
for either LabVIEW or LabWindows/CVI Test Executives with no modification. If you want to
pass additional parameters, you must use the ActiveX Automation API.
The next few slides discuss Method 1, followed by a quick discussion of Method 2, and concluding
with a discussion of Method 3.
Input Buffer
Type: String Control
Purpose: To pass data into a VI. Data can be flattened into a string and then unflattened within
LabVIEW for compatibility with LabVIEW data types.
Invoke Info
Type: Cluster of Five Controls
• UUT Number: Integer
• Loop Number: Integer
• UUT Info: String
• Test Name: String
• Sequence Path: Path
Purpose: To provide basic information about the sequence and UUT to the test module.
Test Data
Type: Cluster of Four Indicators
• Pass/Fail Flag: Boolean
• Numeric Measurement: Double
• String Measurement: String
• Report Text: String
Purpose: To pass data from the test to the TestStand Engine. TestStand also automatically reads
data from a standard LabVIEW error cluster.
Bear in mind that the above structure is for reporting errors with the test system itself, not for test
failures related to the UUT.
In the following exercises, you will create a test in either LabVIEW or LabWindows/CVI using
structures to pass results to TestStand, and you will learn how to debug and step into the test directly
from TestStand.
Data Space
• Flexible DLL Adapter Data 1
• Sequence Adapter
These three adapters can specify an arbitrary number of parameters that should be passed from the
code module back into TestStand. Although parameters are still being used to pass the data between
code modules and TestStand, this ability to specify an arbitrary number of parameters sets
Method 2 apart from the process described in Method 1.
Method 3—Using the ActiveX Automation API to Access Properties and Methods
Another method to pass data between a test module and TestStand is to use ActiveX Automation.
ActiveX Automation is a standard method for passing data between Windows applications.
It allows one application to pass data to or control another application by changing its properties
and calling its methods. An ActiveX application can be thought of as an object used within another
environment.
Using ActiveX, an object of the sequence context can reside in the test module. When executing
sequences, TestStand maintains a sequence context that contains references to all global variables,
local variables, and step properties in active sequences. The contents of the sequence context
change depending on the currently executing sequence and step.
If you pass a sequence context object reference to the code module, you can use the TestStand
ActiveX API to access the variables and properties in the sequence context. By setting properties
and invoking methods, you can pass data between the test module and the TestStand sequence, and
set or change various TestStand attributes from within the test module itself.
In TestStand, the ActiveX API uses the Sequence Context object reference to pass the following
data:
• Type: ActiveX Automation reference handle.
• Purpose: You can wire this reference into a Set Property or Invoke Node to access TestStand
properties and methods pertaining to the sequence being executed (this topic is addressed in
greater detail later).
ActiveX
Client
ActiveX
Client
Properties,
Methods
ActiveX
Server
In addition, test modules can also access the TestStand Engine ActiveX API to get/set the values
of TestStand variables or to invoke certain methods.
An example of a TestStand property is the value of a local or global variable. These values are
maintained by the TestStand Engine, but can be accessed by an Operator Interface, Sequence
Editor, or code module. Some examples of TestStand methods are (DisplayLoginDialog) and
(UnloadAllModules), which ActiveX clients can call the TestStand Engine to execute.
Note To use TestStand 2.0 VIs with LabVIEW, you must have LabVIEW 5.1 or later.
It is also important to remember that by using ActiveX Automation, you have access to not only
the data relevant to the specific code contained within a test, but also to many of the TestStand
environment attributes and functions, thereby allowing changes to sequence information during
run-time.
In the next set of exercises, you will use ActiveX to pass data within either LabVIEW or
LabWindows/CVI.
Exercise 5-7
5-7 Objective: To pass data between TestStand and
your test module using the DLL Flexible Prototype
Adapter
Code Templates
• Code templates are
configured through
the step type
properties found in
the Type Palette
• Code template code
is stored in the
TestStand\Code
Templates directory
Code Templates
Code templates are created and configured from the Code Templates tab of the step type
properties dialog box in the TestStand Type Palette. The lesson on TestStand types later in this
course discusses customizing step types and the Type Palette in detail. The actual code for each
template is in the TestStand\Code Templates directory.
Summary
In the previous lesson, you learned how to share data between sequence steps (locals), multiple
sequences (sequence globals), and sequence files (station globals). In this lesson, you learned how
to share data between TestStand and test modules developed in another programming environment.
You can use structures, as used in National Instruments Test Executive Toolkits, you can use an
arbitrary number of parameters, or you can leverage the ActiveX capabilities of the engine (server)
and development environments such as LabVIEW, LabWindows/CVI, or Visual Basic (clients).
The first two options are dependent on which Adapter you chose to call the code module. The last
option depends upon how you write the code module itself.
TestStand also includes a method to reduce redundant programming. Using code templates, test
module developers can duplicate common components used throughout their test modules.
Note If you are using either LabWindows/CVI or LabVIEW, you can use National
Instruments IVI driver technology to perform test software development without
requiring instrumentation hardware. This instrument driver technology provides features
such as state caching, simulation, and an attribute model for convenient test development.
For more information about IVI, refer to Appendix A.
In the sequence window, right-click below the existing steps and select
Insert Step»Tests»Pass/Fail Test. This inserts a Pass/Fail step for the
LabVIEW Adapter at the bottom of the sequence. Name the test
Keyboard Diagnostics.
3. Right-click on the step and select Specify Module. This brings up the
LabVIEW Step Module Information dialog box. For the VI Pathname,
click the Browse button, type in the VI name Ex 5-1A Keyboard
4. Check Show VI Front Panel When Called. Click the Create VI…
button. When prompted for the pathname, be sure that the
C:\Exercises\TestStand I\VIs\ directory is selected and then
click OK to confirm that the VI should be created in the VIs
subdirectory.
End of Part A
End of Part B
2. On the Target tab within the New script dialog box, specify the name to
give to the DLL and its location.
a. Change the Build target to Shared Library (DLL).
b. Change Target file name to Ex 5-1A Keyboard Diag.dll.
c. Rename Destination directory to C:\Exercises\Teststand I
\VIs. When you build the DLL, it will be placed in this directory.
Note that when you change directories, the Support file directory
field is automatically updated to C:Exercises\Teststand I
\VIs\data.
d. Leave other options set to default. Note that under Build Options,
the default selection is to create Single target file containing
all VIs.
3. The resulting New script dialog box should resemble the following
image.
4. Select the Source Files tab in the New script dialog box. Here, you need
to specify the name of the VI that is to be used to build the DLL. Click
on Add Exported VI to bring up the file selection dialog window.
Browse to C:\Exercises\Teststand I\VIs directory and select
Ex 5-1A Keyboard Diagnostics.vi. Note that as soon as you
make the selection by clicking Open from the file dialog window,
LabVIEW brings up the Define VI Prototype dialog box.
5. In the Function Name text field, enter KeyboardDiagnostics. This is
the name that will be given to the function that will contain the code for
Ex 5-1A Keyboard Diagnostics.vi in the DLL.
6. Note that the default calling convention is set to C Calling
Conventions. The VI does not have any input parameters but it does
have output values. To specify the error out and TestData outputs, click
the “+” button next to the Parameters listbox. Select error out from the
VI Output selector for the first output parameter. Click the “+” button
again to add the TestData output parameter. The Define VI Prototype
dialog should now appear as shown.
Note If this is the second time you are creating a DLL in the same location, you will
receive a message indicating that the previously created DLLs and its supporting files
will be overwritten. At this point you can either continue and overwrite existing files or
cancel the build operation.
You are now going to configure the Keyboard Diagnostics step so that it
calls the DLL function that we have just built using LabVIEW.
10. Right-click on the Keyboard Diagnostics step and select Specify
Module… to display the Edit DLL Call dialog box.
a. For DLL Pathname, browse and select
C:\Exercises\Teststand I\VIs\Ex 5-1A Keyboard
Diag.dll.
b. For Function Name, select KeyboardDiagnostics from the pull
down list.
Note When using the C Struct category you must have the corresponding data structure
defined within the TestStand environment and have the Allow Objects of This Type to
be Passed as Structs data type property enabled. This was already taken care of for this
exercise. For more information regarding C Structs as parameters, please see the
TestStand User Manual.
End of Part C
4. Click on the Source Code tab. For the Pathname of Source File
Containing Function, type in CVI Project Files\Keyboard
Diagnostics.c. For the Pathname of CVI Project File to Open,
type in CVI Project Files\Keyboard Diagnostics.prj.
Notice that the source code file and project file do not yet exist. This
exercise will show how to create these files. Click on Create Code.
5. Save the source code file in the \CVI Project Files\ directory
where the Keyboard Diagnostics.prj is located.
After the line int error = 0; add the KeyboardDiagnostic test using
the MessagePopup function panel and the parameters shown below:
MessagePopup ("Message Popup", "This is the keyboard
diagnostic test");
After the line Error:, type in the error information as shown below:
testError->errorFlag=FALSE;
testData->result = PASS;
The C/CVI test functions use two pointers to structures to pass data
between TestStand and the test functions. In the KeyboardDiagnostics
test, testError->errorFlag is set, which indicates whether a
run-time error occurred. The other structure, testData->result,
indicates whether the Unit Under Test passed or failed the test. The
resulting screen should appear as shown below.
End of Part A
End of Part B
Part C: Create a DLL Code Module for the Keyboard Diagnostic Test
1. National Instruments recommends using DLL files rather than object
files for test modules. Using LabWindows/CVI, open
C:\Exercises\TestStand I\CVI Project Files\Keyboard
Diagnostics.prj if you closed it before.
2. From the LabWindows/CVI project window, ensure that the project
target is set for Dynamic Link Library under the Build»Target Type
menu.
9. Click OK to leave the Edit C/CVI Module Call dialog box. Execute the
sequence to verify that it behaves the same as when using an object file.
10. Note that if you try to rebuild the DLL while an application such as the
Sequence Editor is using it, you will get a “file access permission
denied” error. In the Sequence Editor, select File»Unload All Modules
to unload the DLL, allowing you to rebuild it if necessary.
11. When finished with the exercise, save and close the sequence file.
Save all files and quit LabWindows/CVI.
End of Part C
4. Click the Source Code tab. For the Pathname of Source File
Containing Function, type in CVI Project Files\Ex 5-1C
Keyboard Diagnostics.c. Notice that the source code file does not
yet exist. To create the source code file, click Create Code. The
following dialog box appears.
The DLL test function uses pointers to pass data between TestStand
and the test function. In the KeyboardDiagnostics test,
*errorOccurred is set, which indicates whether a run-time error
occurred. The other pointer, *result, indicates whether the Unit
Under Test passed or failed the test. The resulting screen should appear
as shown below.
11. In the project window, ensure that the project target is set for Dynamic
Link Library under the Build»Target Type menu.
12. Ensure that the DLL to be built is configured as a release version of the
DLL by selecting Build»Configuration»Release.
End of Part A
End of Part B
This exercise shows how to create another type of test in TestStand called a
numeric limit test. Additionally, it demonstrates one way to add
information to the test report. The code module passes numeric data and a
Report Text string back to TestStand. TestStand compares the numeric data
to predefined limits and determines whether the test passed or failed. The
Report Text string is displayed in the report.
view the limits, right-click on the step and select the Edit Limits option.
Click OK to return to the sequence file.
6. You must create the code for this VI, so click on Create VI. When
prompted for the directory to save in, select C:\Exercises\
TestStand I\VIs (if not already selected) and click OK to continue.
Then select a relative path when TestStand asks how to store the path,
just as in Exercise 5-1A. VideoDiagnostics.vi already contains the
TestData and Error Out clusters. These clusters contain information that
TestStand passes to the step properties, so you can now build the block
diagram for this module.
4. When the report is generated, scroll down the report and observe that the
video test is reported as having failed (as you have selected). Continue
scrolling down and note the status of the Video Diagnostics step. Notice
the measurement value returned— it should fall between 0 and 30.
Observe the Report Text string returned from the code module if the
value is greater than 10.
End of Part B
2. On the Target tab within the New script dialog box, specify the name to
give to the DLL and its location.
a. Change the Build target to Shared Library (DLL).
b. Change Target file name to Ex 5-2A Video Diag.dll.
4. Select the Source Files tab in the New script dialog box. Here, you need
to specify the name of the VI that is to be used to build the DLL. Select
Add Exported VI to bring up the file selection dialog window. Browse
to C:\Exercises\Teststand I\VIs directory and select
VideoDiagnostics.vi. Note that as soon as you make the selection by
clicking Open from the file dialog window, LabVIEW brings up Define
VI Prototype dialog box.
5. In the Function Name text field, enter VideoDiagnostics. This is the
name that will be given to the function that will contain the code for
Video Diagnostics.vi in the DLL.
6. Note that the default calling convention is set to C Calling
Conventions. The VI does not have any input parameters but it does
have output values. To specify the error out and TestData outputs, click
the “+” button next to the Parameters listbox. Select error out from the
VI Output selector for the first output parameter. Click the “+” button
Note If this is the second time you are creating a DLL in the same location, you will
receive a message indicating that the previously created DLLs and its supporting files
will be overwritten. At this point you can either continue and overwrite existing files or
cancel the build operation.
You are now going to configure the Video Diagnostics step so that is calls
the DLL function that we have just built using LabVIEW.
10. Right-click on the Video Diagnostics step and select Specify
Module to display the Edit DLL Call dialog box.
a. For DLL Pathname, click on browse button to select
C:\Exercises\Teststand I\VIs\Ex 5-2A Video
Diag.dll.
d. Add the error out parameter by selecting the New button. Type Error
Out for the parameter name, Specify Locals.Error for the Value
Expression. Choose C Struct for the Category. Select
CustomError for the Struct Type. The dialog should appear as
follows.
Note When using the C Struct category you must have the corresponding data structure
defined within the TestStand environment and have the Allow Objects of This Type to
be Passed as Structs data type property enabled. This was already taken care of for this
exercise. For more information regarding C Structs as parameters, please see the
TestStand User Manual.
End of Part C
This exercise shows how to create another type of test in TestStand called a
numeric limit test. Additionally, it demonstrates one way to add information
to the Test Report. The code module passes numeric data and a Report Text
string back to TestStand. TestStand compares the numeric data to predefined
limits and determines whether the test passed or failed. The Report Text
string is displayed in the report.
6. You will do the same for the Pathname of CVI Project File to Open text
box located on the Source Code tab. For the pathname of the project file
enter CVI Project Files\Video Diagnostics.prj. Repeat this
process for the Source Code file. Click OK to return to the C/CVI Edit
Module dialog box, which should now appear as shown below.
9. Ensure that the project target is set for Dynamic Link Library under the
Build»Target menu.
10. Ensure that the DLL to be built is configured to be a debug version of
the DLL by selecting Build»Configuration»Debug.
11. Confirm the DLL target setting by selecting Build»Target Settings.
Make certain the settings match those in the figure below.
End of Part A
End of Part B
This exercise shows how to create another type of test in TestStand called a
numeric limit test. Additionally, it demonstrates one way to add information
to the test report. The code module passes numeric data and a report text
string back to TestStand. TestStand compares the numeric data to predefined
limits and determines whether the test passed or failed. The report text string
is displayed in the report.
Note The file, Ex 5-2C Video Diagnostics.dll does not yet exist. You will be
creating it later in this exercise.
6. In the Edit DLL Call dialog box, click the Source Code tab. Click the
Create Code button. Navigate to the C:\Exercises\TestStand
I\CVI Project Files\ directory and enter the filename Ex 5-2C
Video Diagnostics.c as shown.
TestStand may then ask how to store the path to this code resource.
7. Next, you will be prompted for the code template that you would like to
use. Select, TestStand numeric limit template as shown
below. Click OK to create the source code.
Note Upon clicking on OK above, you may get a message saying that you don’t have
an application associated with files of this type and asks if you want to launch Notepad
to view the file. Click No.
8. Notice that the fields in the Source Code tab of the Edit DLL Call dialog
box are now filled in. In the Edit DLL Call dialog box, click the Module
tab. Notice that the parameters in the ring are now filled in.
9. Before you can implement your test, you need to add another parameter
to the function. You will pass a string parameter that will be displayed
in the report. The new parameter will be created after measurement.
Under the Module tab, in the Parameter ring, select Measurement.
Click the New button to insert a new parameter.
10. Rename the arg3 parameter to reportText. Select String for the
Category. For the Pass ring, select C String Buffer. Use C String
when you do not intend to modify the string and C String Buffer
when you intend to modify the string. For the Value Expression, click the
Browse button and insert, Step.Result.ReportText.
Notice that the Function Prototype and Function Call fields at the
bottom of the window are updated as you fill in the fields. The Module
tab should now appear as shown below.
11. The skeleton code previously created with the template in step 7 must
be modified to reflect the new parameter. Click the Source Code tab
and then on the Verify Prototype button. When the Prototype Conflict
dialog box appears, click Use the Prototype from the Module Tab and
click OK. This displays a dialog box to replace the step code.
12. Click the Replace button to replace the existing function prototype with
the new prototype. Click OK and then OK again in the Edit DLL Call
dialog box.
13. Launch LabWindows/CVI and select File»Open»Project. Open the
project file C:\Exercises\TestStand I\CVI Project
Files\Ex 5-2C Video Diagnostics.prj. If prompted, click Yes
to unload the current project and OK to transfer the project options.
Note The code shown is for illustration only, be sure to use proper syntax in your code.
26. Click OK to return to the Target Settings dialog box. Click OK to close
the Target Settings window.
27. Finally, create the Ex 5-2C Video Diagnostics.dll by selecting
Build»Create Debuggable Dynamic Link Library.
28. Return to the sequence editor. In the Edit DLL Call dialog box, click the
Browse button for the DLL Pathname control and select the Ex 5-2C
Video Diagnostics.dll that you just created. When asked how you
resolve the path to this code module, select Use a Relative Path
and click OK. Click OK to close the Edit DLL Call dialog box.
End of Part A
End of Part B
3. Execute the sequence, check the video test to fail, and the execution
pauses at the breakpoint. Use the watch window, as described in
Exercise 2-2, to watch the result for this step. The value to watch is
RunState.Sequence.Main["Video Diagnostics"].Result.Numeric,
and the hierarchy for selecting it in the Context window is shown below.
4. Click on the Step Into button in the toolbar, which steps into the
LabVIEW code module.
6. With the Breakpoint tool, click on any wire to set a breakpoint. Run the
VI by clicking the Run button. You can use the LabVIEW debugging
tools to debug the code. Click the Pause/Continue button to finish
execution.
7. Click the Return to Caller button to return execution to TestStand. The
value in the watch window should now contain the random number
generated in the test. This value changes only when the LabVIEW code
has finished executing and the return values from the Test Data cluster
have been passed back into TestStand.
8. In TestStand, click the Resume button to finish the execution.
Note It is also possible to debug a LabVIEW DLL. However, because you can only
debug a LabVIEW DLL from within the same process, you must debug the LabVIEW
DLL using the LabVIEW Operator Interface and not the Sequence Editor. To debug a VI
that was compiled into a function in a LabVIEW DLL, you can perform the following
steps:
a. Within LabVIEW, open the VI that was used to build the function
you wish to debug in the LabVIEW DLL.
b. Place a breakpoint within this VI.
c. Within LabVIEW, open and run the top level VI for your LabVIEW
Operator Interface.
d. Within your LabVIEW Operator Interface, select the test sequence
that is calling the function in the LabVIEW DLL that you wish to
debug.
e. Execute the test sequence from within the LabVIEW Operator
Interface.
f. The execution will automatically stop for debugging at the
breakpoint that you placed within the VI in step a, above.
5. Step into the code module by clicking on the Step Into button in the
toolbar.
Exercise 5-3B shows how to step into code modules called with the C/CVI
Standard Prototype Adapter. In contrast, you cannot step into code
modules that are called with the DLL Flexible Prototype Adapter.
However, this exercise demonstrates how to debug your test code from your
C development environment.
1. In the Sequence Editor, select File»Open and select the sequence file
C:\Exercises\TestStand I\Ex 5-3C Debugging Tests
with DLL Adapter.seq. Notice that this sequence is the solution to
Exercise 5-2C except that the Video Diagnostics step calls Ex
5-3C Video Diagnostics.dll. Remember that the solutions for
each exercise can be found in the C:\Solutions\TestStand I
directory.
2. Exit the sequence editor.
3. In LabWindows/CVI, select File»Open»Project. Open the project file
C:\Exercises\TestStand I\CVI Project Files\Ex 5-3C
Video Diagnostics.prj.
4. Open the source file by double-clicking on Ex 5-3C Video
Diagnostics.c listed in the project window. Place a breakpoint
on line 11 which has the following statement:
*measurement = 10 + (rand()%11);
Note Place a breakpoint by clicking on the Line Icons column or by pressing F9 while
your cursor is on that particular line.
This exercise produces the same results as Exercise 5-2A, but it uses the
ActiveX Application Programming Interface (API) to pass result data to
TestStand. Although in this step you will pass the step’s result data, the
ActiveX method for passing data is very useful because it enables you to get
or set any TestStand property or variable, including local or global variables.
You may also need to connect the Sequence Context refnum to the VI
connector pane. Right-click in the icon area of the VI and select Show
Connector. (See the arrow below.)
With the Wiring tool, click on the upper-left terminal of the connector. In the
figure above, this is the blacked-out terminal. With the same Wiring tool,
click on the Sequence Context refnum to associate the front panel object
with the terminal in the connector.
End of Part A
Typically, ActiveX calls pass data into and out of TestStand that cannot be
passed using the TestStand Data Cluster. However, to demonstrate passing
some simple information, in this exercise, the values passed are the same
values that could be passed using the TestStand Data Cluster. In this
exercise, you pass a random number to the Step.Result.Numeric property
of the step that calls this code module. You also pass a string to the
Step.Result.ReportText property of the same step.
You will use two ActiveX VIs to set these step properties:
• Set Property Value (Number).vi sets the numeric value of the
SequenceContext property the Lookup String control specifies.
• Set Property Value (String).vi sets the string value of the
SequenceContext property the Lookup String control specifies.
In this exercise, a random number is passed into the New Value terminal of
Set Property Value (Number).vi, which passes that value to the property
specified by the Lookup String.
The random number is also compared to 10; if it is greater than 10, a text
message is passed to the New Value terminal of Set Property Value
(String).vi. In the false case of the case structure, pass an empty string.
2. Save the VI as C:\Exercises\TestStand I\
VIs\VideoDiagnosticsActiveX.vi.
3. Return to the Sequence Editor.
End of Part B
4. When the report is generated, scroll down the report and observe the
status of the Video Diagnostics step. Notice the measurement value
returned—it should fall between 0 and 30. Observe the Report Text
string returned from the code module if the value is greater than 10.
This exercise produces the same results as Exercise 5-2B, but it uses the
ActiveX Application Programming Interface (API) to pass result data to
TestStand. Although in this step you will pass the step’s result data, the
ActiveX method for passing data is very useful because you can use it to get
or set any TestStand data, including local or global variables.
1. In the Sequence Editor, open Ex 5-4B Using the ActiveX API
with CVI.seq. The rest of this lesson describes how to create the code
module to be used by this step using ActiveX calls.
2. Right-click on the Video Diagnostics step and select Specify
Module. Fill in the resulting dialog boxes as shown below. After you
complete the dialog boxes, the Video Diagnostics step calls the
VideoDiagnostics function created in Exercise 5-2B. Remember that the
solutions for all exercises are in the C:\Solutions\TestStand I\
CVI Project Files directory. Copy all the Video Diagnostic files to
the C:\Exercises\TestStand I\CVI Project Files directory
before continuing if Exercise 5-2B was not completed.
Warning This exercise modifies the behavior of the code for the Video Diagnostics step.
These changes may affect Exercise 5-2B, so be sure to complete that exercise before
completing this one. You can always recreate Exercise 5-2B by repeating it.
3. Right-click on the Video Diagnostics step and select Edit Code
from the menu. This launches LabWindows/CVI and opens the Video
Diagnostics project and source code containing the
VideoDiagnostics function. These files are in the
C:\Exercises\TestStand I\CVI Project Files\ directory.
In Video Diagnostics.c, you will replace the following code with the
ActiveX API equivalent.
testData->measurement = measurement;
if(!testData->replaceStringFuncPtr(&testData->outBuffer,
"Unstable VSS readings at video controller"))
{
error = TS_Err_OutOfMemory;
goto Error;
}
4. Delete the above code and place your cursor below the following line:
measurement = 5 + (rand()%11);
5. Under the Instrument menu, you should find the TestStand API 2.0
instrument driver. If you do not, load TSAPICVI.fp from the
<TestStand path>\API\CVI\ directory by selecting
Instrument»Load.
6. In the TestStand API instrument driver, go to the Property
Object»Values tree and select Set Numeric Value.
Fill in the boxes as shown below. Notice that the function call is filled
in at the bottom of the Function Panel window as you type in the boxes.
Use the function call information to see how to fill in the boxes, because
the screen limitations do not allow all text to be displayed.
7. Right-click in the Function Panel window to see the help for this
function. You can right-click on each control to get help on each
parameter.
8. Some of the parameters used include:
Object Handle: This is a handle to the Sequence Context object in
TestStand and is passed through the tTestData struct. Later in this
exercise, you will see how TestStand actually passes this handle.
Error Info: This is the returned error information. A C-macro handles
this error information and the returned status value. Notice that there are
several error status codes defined in the online help.
Lookup String: To specify the property, pass a string that defines a path
from the object on which you call the method to the specific property
you want to access. To specify the object itself, pass an empty string
(""). To specify a subproperty, pass the name of the subproperty. To
specify a subproperty of a subproperty, pass a string containing both
names separated by a period (.). Later in this exercise, you will see how
to browse for this parameter.
Options: Refer to the online help for a list of available options.
New Numeric Value: The value to set to the property specified by the
Lookup String. You will use “measurement” for this exercise.
9. Close the help window. From the function panel window, select
Code»Set Target File. Be sure the Target File is set to the Video
Diagnostics.c file.
10. Select Code»Insert Function Call to insert this function where your
cursor last was in the Video Diagnostics.c file.
11. Now, you will insert the TS_PropertySetValString() function call
into the source file. Select this function from the same tree, Property
Object»Values, in the TestStand API instrument driver and select Set
String Value. Fill in the parameters as shown below and insert this
function call in the Video Diagnostics.c file.
12. Return to the Video Diagnostics.c file and be sure that you filled
in the function calls as shown.
Note The code shown is for illustration only, be sure to use proper syntax in your code.
TS_PropertySetValNumber (testData->seqContextCVI,
&errorInfo, "Step.Result.Numeric",
0, measurement);
TS_PropertySetValString (testData->seqContextCVI,
&errorInfo,
"Step.Result.ReportText", 0,
"Unstable VSS readings at video
controller");
13. Return to TestStand and click OK to close the Edit C/CVI Module Call
dialog box.
14. Switch to the Sequence Editor and right-click on the Video
Diagnostics step in the sequence file. Select Browse Sequence
Context from the context menu. In this tree, select
Step.Result.Numeric as shown below. This is the same Lookup
String passed into the TS_PropertySetValNumber function call.
Notice that you could have copied this variable/property with the Copy
Property Path button and pasted it into the function call.
Note The code shown is for illustration only, be sure to use proper syntax in your code.
#include "stdtst.h"
#include "tsutil.h"
0, measurement));
if (measurement >10) {
tsErrChkMsgPopup (TS_PropertySetValString (testData->seqContextCVI,
&errorInfo,
"Step.Result.ReportText",
0, "Unstable VSS readings at video controller"));
}
Error:
// If an error occurred, set the error flag to cause a run-time
if (error < 0) {
testError->errorFlag = TRUE;
18. Ensure that the project target is set for Dynamic Link Library under
Build»Target Type.
21. Return to the Sequence Editor and right-click on the Video Diagnostics
step, selecting Specify Module. Be sure the Pass Sequence Context
checkbox is checked as shown below. This checkbox instructs
TestStand to pass the ActiveX handle to the Sequence Context object
in the tTestData structure of the function being called.
22. Notice that in all pathname dialogs, the modules are now in the proper
directories. Click OK to exit the C/CVI Edit Module dialog box.
23. The Video Diagnostics step should execute only if the Video
Test step fails and the Powerup Test and CPU Test steps have
passed. Double-click on the Video Diagnostics step. Click the
Preconditions button. Set the preconditions as shown below.
a. Click Powerup Test in the Insert Step Status section.
b. Click Insert Step Pass.
c. Click CPU Test.
d. Click Insert Step Pass again.
e. When prompted to insert AllOf or AnyOf, choose Insert AllOf.
f. Click Video Test.
24. Save and run Ex 5-4B Using the ActiveX API with CVI.seq
to verify that it works correctly. When this sequence is run, make sure
that the video test is selected to fail. In the test report, verify that the
correct data is returned.
This exercise produces the same results as Exercise 5-2C, but it uses the
TestStand ActiveX Application Programming Interface (API) to return
result data to TestStand. Although in this step, you will pass the result data
for the step, the ActiveX method for passing data is very useful because you
can use it to get or set any TestStand data, including local or global variables.
1. In the sequence editor, open Ex 5-4C Using the ActiveX API
with the DLL Adapter.seq. The rest of this lesson describes how
to create the code module.
2. Right-click the Video Diagnostics step and select Specify Module.
Fill in the resulting dialog boxes as shown below. After you complete the
dialog boxes, the Video Diagnostics step calls the
VideoDiagnostics_API function. Remember that the solutions for
all exercises can be found in the C:\Solutions\TestStand I\CVI
Project Files\ directory.
8. Fill in the boxes as shown below. Notice that the function call is filled
in at the bottom of the Function Panel window as you type into the
boxes. Use the function call information to see how to fill in the boxes.
Parameter Value
Object Handle seqContextCVI
Error Info &errorInfo
Lookup String "Step.Result.Numeric"
Options 0
New String Value 10 + (rand()%11)
9. Right-click in the function panel window to see the help for this
function. You can right-click each control to get help on each parameter.
10. Some of the parameters include:
• Object Handle—This is a handle to the Sequence Context
object in TestStand. Later in this exercise, we will see how TestStand
actually passes this handle.
• Error Info—This is the returned error information. A C-macro
handles this error information and the returned status value. Notice
that there are several error status codes defined in the online help.
• Lookup String—To specify the property, pass a string that defines
a path from the object on which you call the method to the specific
property you want to access. To specify the object itself, pass an
empty string (""). To specify a subproperty, pass the name of the
subproperty. To specify a subproperty of a subproperty, pass a string
containing both names separated by a period(.). Later in this
exercise, we will see how to browse for this parameter.
• Options—Refer to the online help for a list of available options.
• New Numeric Value—The value to set to the property specified by
the Lookup String. You will use a random number for this exercise.
11. Close the help window if open. From the function panel window, select
Code»Set Target File. Be sure the target file is set to the
VideoD_API.c file.
12. Select Code»Insert Function Call to insert this function where your
cursor was in the VideoD_API.c file.
13. Now, you will insert the TS_PropertySetValString() function call
into the source file. Select this function from the same tree: Property
Object»Values, in the TestStand API instrument driver. Fill in the
parameters as shown below and insert this function call in the
VideoD_API.c file.
Parameter Value
Object Handle seqContextCVI
Error Info &errorInfo
Lookup String "Step.Result.ReportText"
Options 0
New String Value "Unstable VSS readings at video controller"
14. Return to the VideoD_API.c file and be sure that you filled in the
function calls as shown.
Note The code shown is for illustration only, be sure to use proper syntax in your code.
Note All properties and variables could be referenced with similar lookup strings.
17. Return to LabWindows/CVI. Finally, check the error status with a macro
that is defined in tsutil.h. tsErrChkMsgPopup() displays the
error description and jumps to the label Error:. Enter the macro as
shown in bold below. Make sure that the code appears exactly as shown
below.
Note The code shown is for illustration only, be sure to use proper syntax in your code.
#include "stdtst.h"
#include "tsutil.h"
void __declspec(dllexport) __stdcall
VideoDiagnostics_API(CAObjHandle
seqContextCVI, short *errorOccurred, long *errorCode, char
errorMsg[1024])
{
int error = 0;
ErrMsg errMsg = {'\0'};
ERRORINFO errorInfo;
tsErrChkMsgPopup(TS_PropertySetValNumber,(seqContextCVI,
&errorInfo, "Step.Result.Numeric", 0, 10 +(rand()%11)));
tsErrChkMsgPopup(TS_PropertySetValString (seqCotextCVI,
&errorInfo, "Step.Result.ReportText", 0, "Unstable VSS
readings at video controller"));
Error:
// FREE RESOURCES
// If an error occurred, set the error flag to
// cause a run-time
// error in TestStand.
if (error < 0)
{
*errorOccurred = TRUE;
*errorCode = error;
strcpy(errorMsg, errMsg);
}
return;
}
18. Save VideoD_API.c.
19. VideoD_API.fp was already created for you. We will use this function
panel file to create a type library. A type library is a component of a DLL
that can be used by TestStand to look up the function prototype when a
function call is specified. The type library exposes the functions and
arguments to the user of the DLL. This allows the user to view from
TestStand the parameters of a function in a DLL.
Note For more information on type libraries for LabWindows/CVI please refer to the
LabWindows/CVI User Manual. For information on how to create type libraries in VC++
please refer to the knowledge base document Creating a Type Library Using Visual C++
in our web site at ni.com
20. From the project file, ensure that the target is set for Dynamic Link
Library under Build»Target Type. Ensure that the DLL to be built is
configured to be a release version of the DLL by selecting
Build»Configuration»Release.
21. Confirm the DLL target settings by selecting Build»Target Settings.
Make certain the settings match those in the figure below.
Click Type Library and check the box next to Add Type Library
Resource to DLL. Click the Browse button and choose the file
VideoD_API.fp. The window should resemble the one shown below.
22. Click OK to close the Type Library Window. Click OK to close the
Target Settings window.
23. Create the DLL by selecting Build»Create Release Dynamic Link
Library from the menu. You should get a message notifying that the
files were successfully created.
27. Save and run Ex 5-4C Using the ActiveX API with the DLL
Adapter.seq to verify that it works correctly. When this sequence is
run, make sure that the Video Test is selected to fail. In the test report,
verify that the correct data is returned.
Write a test function that generates and plots a sine wave. Measure the
estimated AC content of the sine wave and return this value as the numeric
measurement to TestStand. This AC value will be compared with user
defined limits within TestStand. For this step use the following limits:
• 0 <= Measurement <= 3.
• Name your step SineACEstimator.
• Name your test VI SineACEstimator.vi.
Hints:
Use a Numeric Limit Test step type that uses the LabVIEW Standard
Prototype Adapter.
Create a SubVI that generates and plots a sine wave. This SubVI should
have 4 inputs and one output as described below:
Parameter Data Type Object Type
Samples I32 Numeric Control (Input)
Amplitude DBL Numeric Control (Input)
Cycles DBL Numeric Control (Input)
Plot Title String String Control (Input)
Sine Wave DBL Waveform Graph (Output)
Note Use constants in the top level VI as inputs to the above SubVI parameters in
LabVIEW. In Exercise 5-6A you will get the parameter values from variables defined in
TestStand through the TestStand ActiveX API.
VIs to use:
Sine Pattern.vi, which can be found in:
Analyze»Signal Processing»Signal Generation
Write a test function that generates and plots a sine wave. Measure the
estimated AC content of the sine wave and return this value as the numeric
measurement to TestStand. This AC value will be compared with
user-defined limits within TestStand. For this step, use the following limits:
• 0 <= Measurement <= 3
• Name your step SineACEstimator.
• Name your test function SineACEstimator.
• Save the source code as CVI Test Functions.c.
• Save the project file as CVI Test Functions.prj.
Hints:
Use a Numeric Limit Test step type that uses the C/CVI Standard
Prototype Adapter.
This exercise will focus on passing data from TestStand to LabVIEW using
the TestStand API. Within the Sequence Editor, open the sequence file
C:\Exercises\TestStand I\Ex 5-5A Simple LabVIEW Numeric
Limit Test.seq. Save this sequence file as Ex 5-6A Simple LabVIEW
Numeric Limit Test API.seq. Create the following local variables in
TestStand:
Name Type Default Values
NSamples Number 2048
NCycles Number 5
Amplitude Number 5
PlotTitle String “Sine Wave API”
This sequence file should contain the step SineACEstimator, which you
created in the previous exercise. Add another Numeric Limit Test step
that uses the LabVIEW Standard Prototype Adapter and name it
SineACEstimator_API. Create a new VI and name it
SineACEstimator_API.vi. This VI will be a modification of the
SineACEstimator.vi that you created in the previous exercise. Use the
TestStand API to pass the local variables above to your test VI instead of
using constants as in Exercise 5-5A.
Hints:
Make sure you check the Sequence Context ActiveX Pointer checkbox as
shown below:
VIs to use:
TestStand - Get Property Value (Number).vi
TestStand - Get Property Value (String).vi
This sequence file should contain the step SineACEstimator, which you
created in the previous exercise. Add another Numeric Limit Test step
that uses the C/CVI Standard Prototype Adapter and name it
SineACEstimator_API. In the source code, CVI Test Functions.c,
create a new function and name it SineACEstimator_API. This function
will be a modification of the SineACEstimator function that you created
in the previous exercise. Use the TestStand API to pass the above local
variables to your test function.
Hints:
Make sure you check the Pass Sequence Context checkbox as shown.
Functions to use:
TS_PropertyGetValNumber, TS_PropertyGetValString.
When using the DLL Flexible Prototype Adapter, data can be passed
directly as parameters or as C structures (containers in TestStand). In this
exercise you will add a step that fills the information of a Graph container
so it can be displayed on the screen.
In the Sequence Editor, when specifying the code module, make sure to pass
the graph information (stored in Locals.Graph) by reference as a C Struct.
Also, pass the RMS variable (Locals.RMSValue) by reference as a double.
Tip To calculate the sine wave, use the Sine Pattern function located under the
Library»Advanced Analysis»Signal Generation menu in CVI.
To calculate the RMS value, use the RMS function located under the Library»Advanced
Analysis»Statistics»Basic menu in CVI.
The rest of the sequence will display the graph and the RMS value. Modify
the statements before the Calculate Graph step to alter the parameters
for the sine wave generation.
Notes An alternative option to alter the parameters for the sine wave generation would
be to use the Pre Expression of the succeeding step. This method behaves similarly,
but avoids the overhead of adding extra Statement steps.
In order to pass data as a C structure, a custom data type with the same elements of the
structure must be created. In the Struct Passing tab of the properties dialog for your data
type, set the Allow Objects of This Type to be Passed as Structs option. Use the
remaining controls on the tab to specify how TestStand formats that data type in memory
when you pass it as a structure parameter. In this exercise, this custom data type and all
of its settings have already been set for you. For more information on TestStand types,
please refer to the TestStand User Manual.
Notes
Introduction
In a test environment, several people often interact with the test executive software for a variety of
purposes. For example, you may have an operator who runs tests, and an engineer who creates the
tests. This lesson introduces user management in TestStand. You will learn how to use the
TestStand user manager to add users and learn how to customize their privileges.
To create a new user, click on the User List tab, right-click in the right pane of the user management
window, and select Insert User. Enter user information such as the user name and password in the
dialog box that appears. The new user’s initial privileges are determined by the user profile you
select. This information is updated in the users.ini file in the <TestStand path>\cfg
directory. TestStand maintains a user list to evaluate the user privileges during login.
TestStand has several predefined user profiles. Profiles are default privilege settings. Only users
who have the configure.editUsers privilege, such as administrators, can edit the existing profiles
or create new profiles with specific privilege settings. A profile defines a set of values for the
properties in the User data type. When you create a new user, you initialize the property values for
the new user from a profile. When you edit a profile, it does not affect the privileges of existing
users.
Operator YES NO NO NO
Exercise 6-1
Note You must have the user configured in the TestStand User Manager for
TestStand-specific data and privileges to be associated with the user.
Lesson 6 Summary:
User Management
• Create multiple users with different capabilities
• Create a variety of profiles using different
combinations of privileges
• Limit modification of information in the User
Manager to users with the configure.editUsers
privilege
• Configure TestStand to automatically login the
Windows system user
Summary
A test/production environment involves a wide variety of users. For each type of user, TestStand
allows you to provide access-level privileges. You can manage users through the User Manager.
The Users.ini file, in the TestStand\Cfg directory, contains the user list. This is the same
directory in which the file StationGlobals.ini maintains persistent information about station
global variables.
Note Rather than copy the contents of the \Cfg directory to reproduce a test station,
choose Run Engine Installation Wizard under the Tools menu. This wizard prompts
you for the files you want to duplicate from the engine throughout all test stations.
3. To insert a new user, right-click in the right pane and choose Insert
User. The following dialog box appears.
4. Type in the user name and password as shown above. The password
selected above is “Joe,” but you can use any password. For now, leave
the user profile as Operator. The user profile assigns a set of default
privileges. The built-in user profiles are Administrator, Developer,
Operator, and Technician. Click the OK button and notice that Joe’s
name appears below the administrator in the user manager. The
following screen should appear.
To create your own user account, repeat steps 3 and 4 and enter the
relevant information.
5. To check the privilege levels for each user, click the + sign next to the
specific user on the left pane to see the different privileges for this user.
The screen below shows the privilege values for the user “Joe.” Notice
that Joe has different privilege values than the Administrator user. Click
the + sign next to “Administrator” to view its privileges.
Note On the tree branches, notice a node labeled Value appears at each level. If this
node is set to True, all subproperties of that branch are considered to be set to True
regardless of their individual setting. When this node is set to False, the individual
subproperty values are in effect. This behavior allows you to grant groups of privileges
by setting a single value to True in the containing privilege.
Note You can always tell who the current user logged on is by looking in the sequence
window. At the bottom there is a display area that lists the current user logged in.
End of Part A
2. Do the same for the rest of the Profiles. These are all individually
configurable. To change the privileges, either double-click on the
privilege in the right window or right-click on the key in the left window
and choose Properties.
When you change a profile property, the change affects all new users
who are created using that profile. The change does not affect any users
who have already been created using that profile. Create a profile when
you need to create more than one user with the same privileges. In this
case, it is easier to create a profile with the privileges already configured
and then create each user with that profile. In this exercise, you will
create a new profile called LeadDeveloper and then create a user with
this profile.
3. To insert a new profile, be sure that Profiles is highlighted in the left
pane and right-click in the right pane and choose Insert Profile. This
creates a new profile. Name the profile LeadDeveloper. The screen
should resemble the following diagram. Close the privileges for the
Operator Profile and open the privileges for the LeadDeveloper profile
just created. Notice that by default, a new profile is created with the
same privileges as the administrator profile.
7. Click the User List tab again to create a new user. With User List
selected in the left pane, right-click in the right pane and select Insert
User. Fill in the information and notice that the new profile
LeadDeveloper is now available as a Profile to use for this new user.
8. Examine the properties for this new user and notice that the only
property not set to True is the EditUser property. Explore the other
properties and profiles to become familiar with them.
9. Feel free to log on as “Jane” as created in this exercise and test some of
the settings that were modified to verify that the user settings were
correctly modified.
10. When you finish examining the user list and profiles, close the user
manager window by clicking the X at the top right corner of the window.
Be sure to log in as administrator before continuing to the next lesson.
Note You can also change the definition of the user type to create new privilege
properties. Refer to the User Management chapter in the TestStand User Manual for
more information.
End of Part B
Notes
Notes
Introduction
In this lesson, you will learn how TestStand collects the test results and how TestStand generates
reports from these results. In particular you will learn which results are collected, when they are
collected, and where the collected results are stored in TestStand. You will also learn how ASCII
text and HTML reports are generated and what formatting options are available in TestStand to
customize reports.
You can control the result collection option for each step on the Run Options tab in the Step
Properties dialog box. You can control result collection for an entire sequence by going to the
Edit»Sequence Properties dialog. You can enable/disable result recording for all sequences on a
station level from the Execution tab in the Configure»Station Options dialog.
In addition to copying step type dependent step properties, TestStand adds a set of standard
properties to each step result. TestStand adds standard result properties to the Step Result as
subproperties of the TS property. These standard result properties include the Start Time, Total
Time, Module Time, Index, Step Name, Step Group, ID, Interactive Execution Number, and
Step Type.
The above screenshot was obtained by placing a breakpoint on a step in the sequence, executing
the sequence by selecting Single Pass from the execute menu, selecting the Context tab from the
execution display, and expanding the Locals.ResultList container.
Subsequence Results
• Locals.ResultList[x].TS.SequenceCall
• The ResultList of the subsequence is shown below as
a property within the results of a SequenceCall step
Subsequence Results
If a step calls a subsequence or generates a call to a callback sequence, TestStand creates a special
Step Result subproperty to store the result of the sequence. The subproperty name will vary
depending on the type of step that called the subsequence or generated a call to a callback sequence,
for example TS.SequenceCall for a Sequence Call step type or TS.PostAction for a Post
Action callback.
TestStand adds the following properties to the above subproperty for each subsequence called:
• SequenceFile—Absolute path of the sequence file that contains the subsequence.
• Sequence—Name of the subsequence that the step called.
• Status—Status of the subsequence that the step called.
• ResultList—Value of Locals.ResultList for the subsequence that the step called. This
property contains the results for the steps in the subsequence.
The ResultList of the subsequence is passed back up to the calling sequence. Therefore, the
ResultList of your top level test sequence is conveniently passed back to the process model
sequence (i.e. Test UUTs or Single Pass) that called the MainSequence of your test sequence.
The importance of this is explained in the following slides.
Report Body
Test Report Callback
Test Report (ModelSupport.dll)
ResultList[0] Sequence
Report Footer
(Reportgen_xxx.seq)
TestStand has two options available for creating the report body, the DLL option and the sequence
option. If the DLL option is selected, the TestReport sequence calls a single function in
modelsupport.dll to build the entire report body before returning. The LabWindows/CVI
project and source code for this DLL is available in the
TestStand\Components\NI\Models\TestStandModel directory. The DLL option is
selected by default, allowing TestStand to generate reports faster. However, when using the DLL
option, the ModifyReportEntry callback is not executed.
If the sequence option is selected under the Configure»Report Options tab, the TestReport
sequence calls the AddReportBody sequence in either reportgen_txt.seq or
reportgen_html.seq to build the report body. The sequence report generator uses a series of
sequences that recursively process the contents of the ResultList parameter.
If the Generate Report File Path option is selected, TestStand will concatenate the report file
pathname to use at run-time based on the available options selected. Some of these options involve
whether to include the sequence file name, time, date, or UUT serial number in the pathname. You
can also select a base report name to be used in every report file pathname that is generated, as well
as specify whether to force each file name to be unique. Some of the options will vary depending
on which process model is being used.
If the Specify Fixed Report File Path is chosen then you enter a fixed report file pathname that
TestStand will always use when saving report files to disk.
There are several ways you can specify the ReportText message string. One method is to set the
string value from within an expresion box inside the step that you want to associate with ReportText
in the report.
Another method is to set the value of the message string directly in your code module. The C/CVI
and LabVIEW module adapters allow code modules to set this property by modifying the
corresponding member of the test data structure or cluster. Refer to Chapter 12, Module Adapters,
of the TestStand User Manual for more information on the property assignments that the module
adapters automatically perform to and from step properties.
You can then use the external application to view reports by selecting the View»Launch Report
Viewer command when an Execution window is active.
Exercise 7-1
Objective: To demonstrate the options for
configuring report generation in TestStand
Lesson 7 Summary
Result Collection and Report Generation
Summary
In this lesson, you learned how the result collection and report generation is handled in TestStand.
In particular, you learned that results from each step are collected and placed into their respective
Locals.ResultList container as soon as the step has finished executing. You also learned that the
contents of each step result container in the ResultList will contain the Step.Result and Step.TS
properties of the step. Other step properties may also be placed in the step result container of the
ResultList but vary from step type to step type. We then discussed how the subsequence results are
passed back up to the calling sequence and how this is what eventually enables all of the results
from your test sequence to be returned to the process model (original calling sequence). Once the
results are returned to the process model upon completion of your test sequences they are sent to
the TestReport sequence. The TestReport sequence formats all of the results into a report. The
format of the report that the TestReport sequence generates can be configured by using the many
options available in the Report Options dialog box obtained by selecting Configure»Report
Options.
2. You can use this dialog box to select the types of information to add in
the test report; including the measured values, test limits, execution
times and array data of each step. The array data can be formatted as a
table or as a graph. There is also an option for appending information to
an existing file.
Note In order to record array data into the report, the array must exist within the
Locals.ResultList container and the appropriate flags must be set. These features
are covered in further detail in the TestStand II course.
The Report Format selector allows you to select either an ASCII text file
or HTML format.
The Default Numeric Format field allows you to select the format of all
numeric data in your report. You can customize this format by clicking the
Edit Format button. You should see the following dialog.
This dialog box specifies the report file pathname information. You can
have the report generated as a temporary file or specify the file to be
saved to disk.
• Generate Report File Path—Select this radio button if you want
the report generator to create pathnames automatically. When you
select Generate Report File Path, you can use the controls in the
Generate Report File Path section of the tab.
• Use Temporary File—Enable this option if you want to write the
report to a temporary file. The report generator deletes the file when
you close the Execution window. Enable this option if you do not
want to save your test report after you close the Execution window.
The default setting for the Directory is the Client Sequence File
Directory, which means the report is saved in the same location as the
sequence file. Click on the selector ring to see the other options for
saving the file to a specific location. Below the Base Name option are
several options for including the Sequence name as a prefix in the
filename, adding the time and date to the filename and forcing a unique
filename. The Append UUT Serial Number to UUT Report File
Name option creates a new file for each UUT in contrast of creating one
file for all UUTs.
This dialog also provides a field that displays the report name, based on
the current selections. This should give you a good idea of what the final
file name will be. It also provides a graphical indicator to illustrate how
the options you select affect the names and contents of the report files.
This helps visualize if the file will contain one or more UUTs as well as
the order in which the UUTs are stored in the report.
At the bottom of the dialog box is an option to specify a fixed path for
all generated reports.
4. Click OK to close the dialog. Open the sequence file located at
C:\TestStand\Examples\Demo\C\Computer.seq. Run the
sequence using either the Test UUTs or Single Pass entry points and
analyze the report.
5. Launch the Report Settings dialog box by selecting Configure»Report
Options from the menu and select different options for creating
different types of reports. View the reports to see the effects of the
changes implemented.
End of Part A
This dialog allows the options for creating one report for all the parallel
UUTs, one report per test socket or an individual report for each UUT.
Many of the options for the Parallel Process Model are similar to those
included with the Sequential Process Model. The main differences are:
• Append UUT Serial Number to UUT Report File Name -
checking this option forces the creation of a separate report file per
each executed UUT.
• Append Test Socket Index to UUT Report File Name – checking
this option forces the creation of a separate report file per test socket.
• If both options are checked, separate report files are created for each
UUT. The name of the file will contain the test socket number
• If no option is checked, one report file for all UUTs will be created.
The Report Options dialog box provides a graphical indicator to
illustrate how the options you select affect the names and contents of the
report files.
3. Click OK to close the dialog. Again, run the demo test sequence,
C:\TestStand\Examples\Demo\C\Computer.seq using either
Test UUTs or Single Pass entry points and analyze the report(s).
4. Launch the Report Settings dialog box and select different options for
creating different types of reports. View the reports to see the effects of
the changes implemented.
End of Part B
When you use the Batch process model, the Report File Pathname tab
on the Report Options dialog box contains additional controls that
designate the files into which TestStand stores batch reports. In
combination with the controls for UUT reports, you can use the batch
controls to specify that all batch and UUT reports reside in the same file,
that all reports reside in individual files, or you can specify other
intermediate configurations. The Report Options dialog box provides a
graphical indicator to illustrate how the options you select affect the
names and contents of the report files.
3. Click OK to close the dialog. Again, run the demo test sequence,
C:\TestStand\Examples\Demo\C\Computer.seq using either
Test UUTs or Single Pass entry points and analyze the report(s).
4. Launch the Report Settings dialog box and select different options for
creating different types of reports. View the reports to see the effects of
the changes implemented.
End of Part C
Note For future exercises, make sure you configure TestStand back to its default process
model setting, the Sequential Process Model. To change the default model, click on the
Configure»Station Options menu and select the Model tab. Select the
SequentialModel.seq file from the Station Model ring. Click OK to close the
dialog.
Notes
Notes
Introduction
Similar to generating reports, TestStand can log UUT results and step results to a database. This
lesson discusses the database interaction features in TestStand. You will learn how to log results to
a database and how to configure the Database Logger. You will also learn how to use the database
step types to interact with the databases.
Database Concepts
The table below shows an example of the following
database concepts:
• Database
• Tables
• Records (rows)
• Fields (columns)
!"
# $%
&' #
&' !"
Database Concepts
In order to better understand how TestStand interacts with databases you must first become familiar
with key database concepts. The database, table, record, and field concepts are illustrated using the
image shown above.
• Database—An organized collection of data. You can store data in and retrieve data from a
database. The data is usually stored in a table as defined below.
• Table—Most modern Database Management Systems (DBMS), also called database servers,
store data in table form. There can be multiple tables in a database. Each table in a database
must have a unique name.
• Record—Analogous to a row in a matrix. The term, record, is often interchanged with the term,
row, since they are similar in meaning.
• Field—Similar to a column in a matrix. Each field in a database table must have a unique name.
In the example above shows results from a test sequence. The fields (columns) are UUT_NUM,
STEP_NAME, RESULT, and MEAS. Each record or row represents a different unit under test
(UUT). Some entries in the MEAS field hold a NULL value. This empty field value is also referred
to as an SQL Null value.
For additional explanation of SQL commands, operators, and functions, see the SQL section of the
TestStand User Manual. This version of SQL is included in the ODBC standard and applies to all
ODBC-compliant databases.
Before you can access data from within TestStand, you must provide a data link which contains
information about the database interface. This could include the provider, the server on which the
data resides, the database or file that contains the data, the user ID, and permissions to request when
connecting to the data source. This will be discussed later in more detail.
You must decide whether to use an ODBC driver or a specific OLE-DB Provider for your DBMS.
Refer to the TestStand\Doc\readme.txt for suggested versions of client DBMS software.
When using the Microsoft OLE DB provider for ODBC Drivers to connect to an ODBC data
source, you must first configure a data source name (DSN) within the ODBC Administrator
available through the Window Control Panel. This is covered in Exercise 8-1. The DSN specifies
which ODBC driver to use, the database file (.mdb), and the optional user ID and password.
If you are using a specific OLE-DB Provider for your DBMS then you can link directly to the
corresponding database from within TestStand.
The Logging Options tab in the Edit Database Logging Options dialog box allows you to choose
whether the test results are logged to a database. As previously explained in the section on
configuring report options (Configure»Report Options), you can also specify what default step
data is logged to the database. This includes adding filtering expressions to add inclusion criteria
for database logging.
With the Connection String Expression control you can directly specify the connection string
expression that TestStand uses to open a data source in which to log results. It can be a literal value
enclosed in quotations, or it can be an expression that is evaluated at run-time. You can use the
Browse button to create the expression. You can also use the Build button to construct the
connection string using the Data Link Properties dialog box. Refer to the Data Link Properties
Dialog Box section in the Database Component Manual for more information.
An example connection string is shown above. This string can be stored in a Microsoft Data Link
(.udl) file. You can use this file later by selecting the Find File button to point to the file. If you
are using a Microsoft Data Link (.udl) file for the connection information, the Connection String
Expression will contain the file path and name of the file, for example, "FILE
NAME=C:\\Program Files\\Common Files\\System\\OLE DB\\Data
Links\\Access.UDL"
Logging Property
• Contains information about:
• Database settings
• Process model data structures
• Results database logger processes
• Uses logging sub-properties in precondition and
value expressions that you specify for a
statement
Logging Property
When the database logger starts, it creates a temporary property named Logging in the sequence
context in which it evaluates expressions. The Logging property contains sub-properties that
provide information about database settings, process model data structures, and the results that the
logger processes. As logging progresses, the logger updates sub-properties of Logging to refer to
the step result or measurement the logger is processing. You can reference Logging sub-properties
in the precondition and value expressions that you specify for a statement. For more detail about
the Logging sub-properties, please see the TestStand User Manual.
The default database logger in TestStand uses other tables to store the more detailed step
information that pertains to certain step types. This additional step information is stored in the
following tables:
STEP_NUMERICLIMIT MEAS_IVI_SINGLEPOINT
STEP_STRINGVALUE MEAS_IVI_WAVE
STEP_MSGPOPUP MEAS_IVI_WAVEPAIR
STEP_CALLEXE
STEP_SEQCALL
STEP_PROPERTYLOADER
The schema design described above provides efficient use of the database tables and makes it more
suited for accommodating new types of step results. It also allows the database logger to record
step results that contain a varying number of similar measurements. See the TestStand User
Manual for a list of the names, data types, and descriptions of each column in the tables mentioned
above.
TestStand comes with SQL script files for creating and deleting the default database tables that the
schemas require. These script files are located in the TestStand\Components\NI\Model\
TestStandModel\Database directory.
Database Viewer
• Designed for:
– Executing SQL commands
– Viewing data
– Editing data
• Views:
– Data Link
– Execute SQL
– Data View
Database Viewer
The Database Viewer is a useful tool for creating, editing, or viewing database tables and data.
This tool can be launched from either the VIEW button on the Data Link tab in the Edit Database
Logging Options dialog box or from the Tools»Run Database Viewer menu selection. There are
three different windows used within the viewer:
• Data Link window—Contains a tree view of existing tables. The list view displays the
contents of the currently selected node in the tree view. Context Menus can be accessed here
by right-clicking on a table in the tree view. These menus include View Data, which displays
table data in a Data View window, Add Table, Drop Table, Add Column, and Drop Column.
You can use these to view or customize your database.
• Execute SQL window—Contains an SQL Commands and an SQL History control. Enter
SQL commands directly and execute using the Go icon button. Or, load SQL script files by
clicking the Open File icon button. Use the Clear icon button to delete the contents from the
SQL Commands control.
• Data View Window—Contains a data grid control of the data returned from an SQL
command. Database Viewer automatically opens a new Data View window when you use
the View Data context menu command or when you issue an SQL command that returns a
record set.
Exercise 8-1
5 Built-in 5 Basic
The Data Link dialog box is very similar to the previously discussed Data Link tab that is available
when you select Configure»Database Options. The only difference is the Database Handle
control, which is used to specify the name of a variable or property of type Number to which you
assign the returned value of the database handle.
The Open Database step type has the property Step.ConnectionString, which specifies a
string expression that contains the name of the data link to open. Step.DatabaseHandle
specifies the numeric variable or property to which the step assigns the value of the opened
database handle.
Note The Advanced tab specifies optional attributes that TestStand sets when opening
an SQL statement. In most cases, the database defines default values for each attribute.
See the TestStand User Manual for more details about the Advanced tab.
When the Edit Data Operation step performs a Get operation, the Value control must contain the
name of a variable or property. When the Data Operation step performs a Put operation, the Value
control can contain a literal value or an expression that TestStand evaluates at run-time.
The Format String control specifies how to convert a string value when assigning a string
expression to a column, or when assigning the value of a column to a string variable or property.
Typically, you use this control when getting or setting data from a column that is of the date-time
or currency type. Refer to the TestStand User Manual for a list of format strings.
The Close SQL Statement step type defines the following step property in addition to the common
custom properties.
• Step.StatementHandle—Specifies the name of the variable or property of type Number
that contains the SQL statement handle to close.
Note TestStand does not automatically close SQL statement handles. You must call a
Close SQL Statement to close your open handles when you are through with them. If you
abort an execution, you must exit the application process that loaded the TestStand engine
to guarantee that TestStand frees all database handles. Selecting Unload All Modules
does not close the handles.
The Edit Close Database step type defines the following step property in addition to the common
custom properties.
• Step.DatabaseHandle—specifies the name of the variable or property of type Number that
contains the open database handle to close.
Note TestStand does not automatically close open database handles. You must call a
Close Database step to close your open handles when you are through with them. If you
abort an execution, you must exit the application process that loaded the TestStand engine
to guarantee that TestStand frees all database handles. Selecting Unload All Modules
does not close the handles.
Exercise 8-2
Summary
A simple sequence of database steps might include the following steps:
• Connect to the database using the Open Database step
• Issue an SQL query on tables in the database using the Open SQL Statement step
• Create new records, and get and update existing records using Data Operation steps
• Close the SQL query using the Close SQL Statement step
• Close the database connection using the Close Database step
3. Create a new data source by selecting the User DSN tab and clicking on
the Add button to display the Create New Data Source dialog box.
4. Select the Microsoft Access Driver from the list and click the Finish
button. The Create New Data Source dialog box appears as shown.
5. In the ODBC Microsoft Access Setup dialog box, enter the name
TestStand Access into the Data Source Name control.
Select the Create button in the Database section of the preceding image.
6. In the New Database dialog box, navigate to
C:\Exercises\TestStand I and enter the database file name
Sequence Data.mdb as shown. Select OK to close the dialog box. You
will be informed that the database was created successfully.
Note The steps you performed in this part of the exercise are only for creating a data
source name and a database file. Once you have created these items once on your system,
you do not have to perform these steps everytime you want to log results to database in
TestStand.
End of Part A
3. Select the Data Link tab. This is the tab where you create a data link for
Teststand to use to identify the data source name and database you wish
to log your results to.
4. Verify that Access is selected for the Database Management System to
use. Select Build to create the Connection String Expression. In the
Provider tab of the Data Link Properties dialog, select Microsoft
OLE DB Provider for ODBC Drivers. From the Connection tab,
select the TestStand Access data source name from the ring selector.
Select the Test Connection button to verify that the connection can be
established properly using your data source name that you specified.
Select OK to close the dialog with your changes.
6. Select the Schemas tab. Select the Generic Recordset (NI) schema
from the list of schemas.
7. Since you are using the default Generic Recordset (NI) schema you
will not need to configure the remaining two tabs. The Statements tab
is used for specifying which tables will be used in the database. The
Columns tab is used for specifying what data will be logged to each
table in the database. The default schemas already contain all of this
information. Select OK to close the Database Options dialog box.
End of Part B
2. This window contains a tree view of the tables that exist in the database
specified by the data link. This window is empty since you have not yet
created tables within your database. The title of the Data Link window
is a portion of your connection string (e.g. Provider=MSDASQL.1;Data
Source=TestStand Access).
3. To create the tables in your database, select File»New Execute SQL
Window from the Database Viewer menu. The Execute SQL dialog
will appear. In the following steps you will execute an SQL script to
create the database tables for you.
4. TestStand installs SQL script files for creating and deleting the default
database tables in Access, Oracle, and SQL Server databases according
to the default schemas. You can load and execute these ASCII text script
files in the Execute SQL window. Click on the open file icon located on
the Execute SQL window toolbar.
End of Part C
4. Repeat the previous step a few more times using different serial
numbers.
5. Select the Stop button on the UUT Serial Number dialog box to end the
execution. TestStand will then automatically generate and display a final
report.
6. View the data that TestStand logged to the database tables. Recall there
are different ways to open the Database Viewer application. For this
step open it by selecting Tools»Run Database Viewer… from the
Sequence Editor menu bar.
Before the viewer can display the data in the database you must specify
a data link to your database. To specify a data link select File»New Data
Link. The Data Link Properties window opens and the Connection
tab is selected. Choose TestStand Access from the Use Data Source
Name ring control. Click OK to close the Data Link Properties dialog
box. The viewer displays a Data Link window that contains the tables
in the database.
7. In the Data Link window, you should see a list of tables including
UUT_RESULT and STEP_RESULT. Right-click on the
UUT_RESULT table and select ViewData from the popup menu. The
viewer displays a new Data View window that contains the tabulated
data as it would appear in Access. You should see several records, one
for each UUT you tested. Note that each UUT test has a unique ID. This
ID is used for referencing step data in the STEP_RESULT table. Using
the horizontal scroll bar you can view data corresponding to each
UUT test.
8. Do not close the Data View window, but return to the Data Link
window by selecting it from the Window menu. Remember that the title
of the Data Link window resembles Provider=MSDASQL.1;Data
Source=TestStand Access, which reflects the connection string of the
data link. Right-click on the STEP_RESULT table and select
ViewData. The viewer displays a new Data View window that contains
the test results for each step tested in the UUT test. You can also view
the specific test result data for each step by viewing the data for its
corresponding table in the database.
9. Close the Database Viewer.
End of Part D
In this exercise you will open the database to which you logged data in
Exercise 8-1. This database contains UUT results from the computer
motherboard simulation test that have passed and failed. You will
programmatically select records from the UUT_RESULT table, which
represent failed UUTs. You will then programatically obtain the serial
number for each failed UUT.
1. In the Sequence Editor, open a new sequence file and save it as
C:\Exercises\TestStand I\Ex 8-2 Using Database Step
Types.seq.
2. Select the Locals tab in the MainSequence and create the following
local variables:
StatementHandle Numeric
NumberOfFailUUTs Numeric
SerialNumber String
ListOfSerialNumbers String
Whenever you open a database using an Open Database step, you get a
handle to the database. Typically this handle is used in an Open SQL
Statement step to identify a set of data within a database table. An Open
SQL Statement step returns a statement handle. The variables
DatabaseHandle and StatementHandle will store the reference to
the database and SQL statement, respectively. The third variable,
NumberOfFailedUUTs, will store the number of records that are
returned for which the UUT failed. The SerialNumber variable will be
used to get store each individual serial number that is obtained. Lastly,
the ListOfSerialNumbers variable will be used to store a combined
list of all the serial numbers.
3. In the Main step group of the MainSequence, insert an Open Database
step by right-clicking and selecting Insert Step»Database»Open
Database from the popup menu. Name the step Open Database.
4. Right-click on the new step and select Edit Open Database. In the Edit
Open Database dialog box, choose Select Data Link and then select
TestStand Access from the list and click OK. This will update the
Connection String in the Edit Open Database window.
5. Select the Browse… button adjacent to the Database Handle control.
From the Expression Browser, insert the expression
Locals.DatabaseHandle and click OK. This will store the returned
value from the Open Database step to the local variable
DatabaseHandle. Your Edit Open Database dialog should resemble
the following image. Click OK to store your changes and close the
dialog.
9. Click OK to return you to the Edit Open SQL Statement dialog box. The
last thing you need to do is enter an expression for the Number of
Records Selected control. Enter Locals.NumberOfFailedUUTs for
this expression. Your dialog should resemble the following image.
Note The SQL statement uses SQL syntax, which is a database standard that is not
unique to TestStand. If you are not familiar with SQL commands and syntax, you may
want to read the SQL section of the TestStand User Manual.
10. Now that you have created a session to a database and obtained a
reference to some data in that database, you need to get the serial
numbers from the selected data. Insert a Data Operation database step
below the Open SQL Statement step. Name the step Data
Operation. Modify the Edit Data Operation dialog so that the
Record/Operation tab resembles the following image.
11. Next you need to modify the contents of the Column Values tab.
TestStand Access should be the specified Data Link Name. Select
the only statement in the ring control for the SQL Statement value.
From the Column Name/Number ring control, select
UUT_SERIAL_NUMBER. For the Value control, enter the expression
Locals.SerialNumber. The Column Values tab should now resemble
the following image. Click OK to store your changes and close the
dialog.
13. Next select the Expressions tab from the Data Operations Properties
dialog. In the Post Expression control, enter the following expression:
Locals.ListOfSerialNumbers+= Locals.SerialNumber + “, ”
Click OK to store your step property changes and close the dialog.
Note You do NOT have to perform a close SQL statement step or a close database step
immediately following the data operation step. These steps are typically placed at the
bottom of the sequence or in the Cleanup step group since they only need to be performed
once for each SQL statement or database reference that is obtained. Thus, if you
performed several data operation steps using the same database and SQL statement
obtained above, you would still only need to call the close SQL statement step and close
database step once at the end of your sequence.
14. Insert a Message Popup step below the Data Operations step. Name the
step Display UUT Serial Numbers. Modify the Configure Message
Box Step dialog so that it contains the following expressions:
15. Insert a Close SQL Statement database step. Name the step Close
SQL Statement. This step will release the reference to the SQL
statement obtained earlier. Modify the Edit Close SQL Statement
dialog so that the Statement Handle control contains the expression
Locals.StatementHandle. Click OK to close the dialog.
16. Insert a Close Database database step. Name the step Close
Database. This step will release the reference to the database obtained
earlier. Modify the Edit Close Database dialog so that the Database
Handle control contains the expression Locals.DatabaseHandle. Click
OK to close the dialog.
17. Save the sequence file Ex 8-2 Using Database Step Types.seq.
18. Since you do not need to log the results from this sequence to the
database, you should disable the database logging from within the
Database Options dialog accessed through the Configure»Database
Options menu item. You can disable database logging by placing a
check in the Disable Database Logging box.
19. Execute the sequence and notice the message popup that appears
indicating which UUT serial numbers from Exercise 8-1 failed the
computer motherboard simulation test.
Notes
Notes
Introduction
In addition to the Sequence Editor, which has been used in most of the previous exercises, operator
interfaces are also ActiveX clients that interface with the TestStand engine through the TestStand
API. In this lesson, you will learn the role of the Operator Interface in the TestStand environment.
You will also learn how to load, run, and debug sequences from the Operator Interface. In the
exercises that follow, you will examine one of the sample operator interfaces that TestStand
provides.
An Operator Interface provides an intuitive user interface for running tests and checking results.
It also has some debugging capabilities for diagnosing problems on the production floor.
It is important to remember that the Sequence Editor and Operator Interface are separate
applications in the TestStand environment. Both the Sequence Editor and Operator Interface
communicate with the TestStand Engine via ActiveX Automation.
The Operator Interfaces allow you to start multiple concurrent executions, set breakpoints, and
single-step just like the Sequence Editor. Unlike the Sequence Editor, however, the Operator
Interfaces do not allow you to modify sequences, and they do not display sequence variables,
sequence parameters, step properties, or other programming variables in TestStand.
If the Operator Interface that you choose does not contain a particular functionality or appearance
that you desire, you can customize the Operator Interface to suit your needs. The TestStand
software provides source code for all four operator interfaces to make modifications possible.
Modifying the Operator Interfaces is not discussed in this course.
Each Operator Interface contains both a sequence display and an execution display. The options
available in each display depend on the login level of the user. These privileges are configured in
the User Management window of the Sequence Editor and restrict access in the Operator Interface
in a similar manner as in the Sequence Editor.
Sequence Display
Sequence Display
The Sequence Display shows the steps in a loaded sequence. Once you load a sequence file, its
name appears in the Sequence File menu ring. Selecting the appropriate sequence file, sequence,
and step group causes the steps of that particular sequence to appear in the Steps window. The
sequence description for the selected sequence appears in the Sequence Description window.
To begin executing a selected sequence, the operator presses either the Test UUT or Single Pass
button. Since the Operator Interfaces have built in user management features, the various menu
items will be made available depending on the current user’s login privileges.
Execution Display
Execution Display
Once a sequence is executing, the Execution Display window appears and the current sequence file,
sequence, and step group are displayed. Each step also appears in the Steps window and is updated
with its pass/fail/error status during the sequence execution. The Execution Display includes a
window for displaying the test report and can launch the report viewer as configured in the
Sequence Editor. Depending on the operator’s privileges, he or she can terminate execution, loop
steps, and debug sequences by single stepping and setting breakpoints.
The following exercise introduces the Operator Interface and its options for sequence execution
and debugging.
UIMessages
TestStand Engine Operator Interface
What is a UIMessage?
TestStand uses UIMessage objects to pass
information to the Operator Interface or
Sequence Editor about the state of the engine
and the current executions.
Examples:
TS_UIMsg_StartExecution = 10
TS_UIMsg_EndExecution = 8
TS_UIMsg_ResumeFromBreak = 17
TS_UIMsg_UserMessageBase = 10000
What is a UIMessage?
The TestStand Engine uses UIMessages to communicate the execution states and other
asynchronous information to your application.
When you write an application that runs TestStand sequence files, you do not handle the details of
executing each step. Instead, you call the TestStand Engine to begin executing the sequence file in
a new thread, and the engine notifies you asynchronously of the state of the execution. The Engine
notifies you of the execution state by sending messages such as Start, End, Break, and Trace.
You can update your application's user interface in response to these messages.
For example, TestStand posts a UIMessage with the event code, TS_UIMsg_StartExecution,
when a new execution is started. TestStand also defines a base value event code of 10000, beyond
which you can define customized UIMessages for unique purposes. You must program the
Operator Interface to respond to custom UIMessages. The Sequence Editor discards custom
UIMessages so custom UIMessages will not affect operation of the Sequence Editor.
The process of writing an Operator Interface is addressed in detail in the help document located at
Start»Programs»National Instruments TestStand»Online Help»TestStand Programmer
Help»Writing An Application.
Exercise 9-1
Lesson 9 Summary:
The Operator Interface
• The Operator Interface is a separate ActiveX
client application used on the test floor
• The main purpose of the Operator Interface is
to execute and debug sequences
• The TestStand operator interfaces are
shipped with source code in LabVIEW,
LabWindows/CVI, Visual Basic, and Delphi
• Operator Interface utilizes UIMessages
posted by the TestStand Engine to determine
the current execution state of the Engine
Summary
In this lesson, you learned about the Operator Interface component of TestStand. The Operator
Interface is an ActiveX client application separate from the sequence editor. Because it is separate
and provided in source code, you can ensure that each operator possesses the test interface you
designate.
The operator interface appears as shown below. The Steps list box
displays all steps in the currently selected sequence file. More than one
sequence file can be open at a time.
Note The following screens are all available in both the operator interfaces and in the
Sequence Editor. However, many of the screens have more options available when
accessed from the Sequence Editor than when they are accessed from the operator
interface. Regardless of where these options are accessed from, the changes made affect
all instances of TestStand, operator interfaces, and the Sequence Editor. The screens
pictured in this exercise were accessed from the operator interface.
3. Within the operator interface, you can debug test modules just as in the
Sequence Editor.
Choose Configure»Adapters. An Adapter Configuration window
similar to the one shown below should appear. Select C/CVI Standard
Prototype Adapter and click on the Configure button.
5. From within the operator interface, you can also alter the TestStand
engine configuration by selecting Configure»Station Options. From
the Station Options dialog box, you can set the Execution, Time Limits,
Preferences, Model, User Manager, and Language options of the
TestStand engine. Each option is discussed below in greater detail.
Execution Options
In this window, you can specify the time limit for how long a test can
take when executing, terminating, or aborting before some action should
be taken.
Normal Execution Settings
Time Limit Settings When executing, no time limit
When terminating, no time limit
When aborting, time limit of
10 seconds, prompt for action
Exiting Settings
Time Limit Settings When executing, time limit of
10 seconds, prompt for action
When terminating, time limit of
5 seconds, prompt for action
When aborting, time limit of
5 seconds, prompt for action
Preferences Options
In this window, you can set various station preferences. You can specify
whether you would like TestStand to display its hidden properties. You
can specify whether TestStand prompts you to locate files it cannot find.
You can have TestStand display a prompt before changing the system
SetForegroundWindow behavior. You can inform TestStand to
automatically increment the various sequence file versions. You can
have TestStand reload documents when opening a workspace and you
can specify whether you want TestStand to reload the last workspace
when it starts up. Lastly, you can inform TestStand to use the computer
name for the test Station ID.
Model Options
In this window, you can specify the TestStand model file. For this
exercise, the model should be <TestStand Path>\Components\
NI\Models\TestStandModels\SequentialModel.seq.
In this tab, you can set the user configuration options for TestStand. For
this exercise, select the Check User Privileges box to enable the user
privilege checking. Also, check the Use Default box in the User
Manager File section. The default file should be
c:\TestStand\Cfg\Users.ini.
Note The Automatically Login Windows System User option logs in users
automatically with the network login required by the computer.
Note To protect the Users.ini file, you can place this file on a Windows NT machine
where only Administrators have write access to it.
Localization Options
In the Localization tab, you can select the language used in TestStand.
Use the Source Control options tab to specify whether you want a dialog
box to prompt you to check out a file when you edit a sequence file that
is in the current workspace and is checked into source control. You can
also have TestStand prompt you to add a file to the source control
system when you insert the file into the workspace. You can also specify
that a dialog box be displayed that lists the files you are checking out
when you check out files using the Workspace window. There is also the
option to only display selected workspace files in source code control
dialog boxes. Lastly, you can change your default source code control
provider.
Click Cancel to return to the operator interface.
In the Customize Tool Menu window, click the Add button to add an
option to the Tools menu.
End of Part A
From the sequence display, you can see the steps in the test sequence
(computer.seq for this exercise). The sequence display is comparable to
the sequence window in the Sequence Editor, although it does not allow you
to create new steps or edit existing ones. The Test UUTs button causes the
sequence to run continually, while the Single Pass button causes the
sequence to execute only once. You can also run an individual test within the
sequence by selecting (placing a check on) that step and selecting
Execute»Run Selected Steps or Execute»Loop on Selected Steps.
1. Make sure that Tracing is enabled by verifying Execute»Tracing
Enabled has a check-mark next to it. If tracing is not enabled, select
this menu item to enable it. Click the Single Pass button to run
computer.seq once. When the execution begins, the display view on
the operator interface window automatically switches to the execution
display.
With tracing enabled, the Steps box displays the status of each test as it
executes. After the sequence completes, the test report is generated.
Click the Launch Report Viewer button to launch the viewer
associated with the report file (specified in Configure»External
Viewers). In this exercise, an HTML document was generated, and the
external viewer launched is either Internet Explorer or Netscape
Navigator, depending on how the computer is configured. Examine the
report file and close the browser when finished.
2. From the operator interface window, choose File»Close Execution or
click on the X in the upper right corner to close the execution display.
3. You can debug sequences and code modules in the operator interface
also. To set a breakpoint on a particular step, select that step from the
Steps box and choose Debug»Toggle Breakpoint. The letter “B” is
placed to the left of the step to indicate that a breakpoint has been set.
6. Choose Debug»Step Into from the menu. This causes execution to step
into the CPU sequence.
7. Choose Debug»Step Over to step over the Pre-Test.
Note Selecting Debug»Step Into can enable you to step into LabWindows/CVI code.
This is because in Part A of this exercise, you selected the option for the C/CVI Standard
Adapter Configuration to use an external instance of LabWindows/CVI. This means
LabWindows/CVI can launch the code directly, and you can use the LabWindows/CVI
debugging tools to step through the code. To explore this option more fully, finish this
execution and run the sequence in Single Pass mode again. This time, select Debug»Step
Into at the Pre-Test step.
End of Part B
Notes
Notes
Introduction
This lesson discusses how to import and export variables and properties for your sequences using
the Import/Export Properties tool and the Property Loader step type. You will also learn how to
distribute your TestStand test environment once you are ready to deploy it.
Import/Export Properties
• Use the Import/Export Properties tool
• Launch from Tools»Import/Export Properties
• You can import/export properties to/from the
following formats:
– Files (.txt, .csv, .xls)
– Database
Import/Export Properties
For some applications, it may be more efficient to operate the same sequences using different
variable and property values (i.e. testing multiple models within the same product line) rather than
writing separate sequences for every model. You can use the Import/Export Properties tool to
import variable and property values into a sequence from a file, database, or Windows clipboard.
You can also use this tool to export variable and property values from a sequence to a file, database,
or Windows clipboard. Launch the Import/Export Properties tool by selecting
Tools»Import/Export Properties.
You usually insert the Property Loader step in the Setup step group of a sequence, so that the
Property Loader step initializes the limit values before the steps in the Main step group execute.
The source of the values can be a tab-delimited text file (.txt), a comma-delimited text file
(.csv), an Excel file (.xls) or a database. You can use the Property Loader step together with
expressions to specify different files or database data links dynamically.
Exercise 10-1
Exercise 10-2
Exercise 10-3
Distributing TestStand
How to distribute TestStand
• Create a TestStand Run-Time engine installation
• Distribute the Operator Interface
• Distribute sequences and code modules
UUT
UUT
Development UUT
Computer
Test Floor
Distributing TestStand
Another useful feature of TestStand is the ability to distribute it to other computers. The Sequence
Editor helps develop test sequences but is not likely to be needed by an operator who will run
sequences but not develop them. You can use the TestStand Run-Time Engine to deploy TestStand
on computers other than the development system. The process for deploying TestStand involves
three steps:
• Create a TestStand Run-Time Engine Installation
• Distribute the Operator Interface
• Distribute the Sequences and Code Modules
Note If you are calling LabVIEW code from your test sequences and you are using a
LabVIEW Operator Interface, you should consider taking advantage of a LabVIEW
feature that allows you to build the LabVIEW ActiveX Server into the LabVIEW
Operator Interface executable. This feature can be enabled by selecting the Enable
ActiveX Server option from the App Settings tab in the LabVIEW Application
Builder. This feature is automatically enabled if you use the testexec.bld build script
when you build your LabVIEW Operator Interface executable. This script is installed in
the \TestStand\OperatorInterfaces\NI\LV\ directory when you install
TestStand. If you choose to not use the Enable ActiveX Server option, you will have to
create a LabVIEW Operator Interface executable and a LabVIEW Run-Time ActiveX
server executable.
If you have written your code modules using LabVIEW, there is a convenient tool available that
will bundle up all of your top level VIs and their subVIs for each sequence. This tool can be
accessed from the menu Tools»Assemble Test VIs for Run-Time Distribution.
If you are writing your code modules using LabWindows/CVI, there are significant advantages to
calling your code modules as DLLs rather than *.c, *.obj, or *.lib. It is much easier to
distribute a DLL than it is to distribute an entire project and all its supporting *.c and *.obj files,
especially when you have large projects.
For information about these steps, see the TestStand User Manual.
This expression defines the numeric result for this step to be a random
number between 0 and 1. Click OK to return to the sequence display
window.
4. Copy the new step by either selecting it and pressing <Ctrl-C>, or by
right-clicking on it and choosing Copy. Paste four copies of the step by
pressing <Ctrl-V> four times or right-clicking in the window and
selecting Paste. Name the steps so that they read Resistor 1 Test,
Resistor 2 Test, Resistor 3 Test, and so on.
5. Click on the Locals tab within the MainSequence. Insert a new local
variable of the string data type. Name the variable ResultString.
6. Click back on the Main step group tab within the MainSequence. Add
a string value test to the end of the sequence by right-clicking in the
sequence window and selecting Insert Step»Tests»String Value Test.
Name the new step Instrument Query. Edit the Post Expression of
the Instrument Query test to be:
Step.Result.String = Locals.ResultString
7. Save the changes you have made the sequence file. The sequence should
now appear as shown below.
properties you are interested in from this list. To select all of the step
limit properties, simply click on the Limits > button. To add the
Locals.ResultString property to the list of selected properties, highlight
the property in the list of available properties and then select the
> button. The Properties tab should resemble the following image.
11. Now you are ready to export the selected properties and their
corresponding values to a file. To do this, select the Export button from
the Import/Export Properties dialog. You should receive a message
popup indicating that 17 property values and 1 variable value were
exported as shown.
12. This message indicates that you have successfully exported the selected
properties to the file C:\Exercises\TestStand I\Limits.txt.
Close the message by selecting the OK button. Close the
Import/Export Properties tool by selecting the Done button.Use
Windows Explorer to browse to the directory and open the
Limits.txt file. Leave this file open for the next step.
13. TestStand has created this file where each step that contains any of the
selected properties occupies a row. In this case, all steps have associated
properties, but if there were steps that did not contain the selected
properties (a Pass/Fail step, for example), these steps would not appear
in the file. Each column of the file is used for a property field. The five
numeric tests use the Limits.High and Limits.Low columns, while the
string value test uses only the Limits.String column. The variable
properties use the sections below the steps for each scope of variable
(i.e. locals, file globals, and station globals). In this case, the only
variable exported was the ResultString local variable. Edit the text file
to reflect the values as shown and be sure to save the changes made to
the Limits.txt file.
14. Now that you have edited the selected properties, you need to import
them back into the sequence. Launch the Import/Export Properties
tool again, verify that the correct file is still specified and the correct
properties are specified. Click the Import button in the Import/Export
Properties dialog box. A dialog box should indicate that 18 limits were
found and imported from the file.
4. Click on the Source tab. For the File Location, browse and select the
file C:\Exercises\TestStand I\Limits.txt. If prompted,
specify that you would like to add the directory containing the selected
file to the list of search directories. Select Tab Delimited Text (.txt) for
the File Format option. The remaining settings can be left with their
default values. The Source tab should now resemble the following
image.
5. Click OK to store your changes and close the Edit Property Loader
dialog. Save the changes made to the sequence file.
6. Open the C:\Exercises\TestStand I\Limits.txt file and edit
the property values to reflect the changes shown in the following image.
Be sure you save the Limits.txt file after making the changes.
8. Remove the breakpoint that you set on the Load Properties step in
step 7 of this exercise before continuing to the next exercise.
This expression loads the file with the name Limitsx.txt, where x
corresponds to the button selected by the operator.
Note The x value is obtained from the Result.ButtonHit property value NOT the
expression specified for the button, i.e. if Button 1 was labeled “25”, Result.ButtonHit
would still yield the value “1” and NOT the value “25”. This exercise could have also
enabled the response text box within the message popup step and had the operator type
in a “1” or a “2” rather than use buttons.
Notes
Appendix A: Introduction to
Interchangeable Virtual Instruments
As the tools and techniques for test system development have evolved, test developers have shifted
to a more modular approach for controlling instruments. This evolution has driven test developers
from writing programs with instrument commands littered throughout their code to using modern
techniques for packaging instrument I/O commands in self-contained “instrument drivers”. The
benefits of separating instrument I/O code in instrument drivers from test logic code are
tremendous—not only is it easier to write your test programs, it is also easier to maintain your test
code when you use instrument drivers.
What is IVI?
In early 1997, National Instruments was approached by several instrument end-user companies
interested in developing a new standard for instrument drivers that would be built on existing
approaches such as VXIplug&play and would also address several concerns such as instrument
state-caching, simulation and interchangeability.
As a result of the discussions, a group of nine companies formed the Interchangeable Virtual
Instruments or IVI Foundation. The charter of the Foundation is to define a standard programming
interface for instrument drivers while allowing for instrument interchangeability, regardless of the
instrument manufacturer or I/O bus interface.
The Foundation developed the standards by identifying common instrument types such as digital
multimeters or oscilloscopes, and then identifying a common set of features within each instrument
type and dividing the features into three groups: base capabilities, extension capabilities, and
vendor specific capabilities. The Foundation then developed a set of specifications for each of these
instrument types, and defined that as an instrument class.
• Intelligent
– State Caching
– Multithreading
– Simulation
• Interchangeable
– Generic instrument classes
– Class drivers
– Configuration in MAX
• Easy to use
The “intelligent” side of IVI drivers refers to state caching, multithreading and simulation. State
caching refers to the driver’s ability to maintain the state of the instrument in software, thus
eliminating redundant I/O. For example, when performing a frequency sweep, the function that sets
the frequency may set three or four other instrument attributes. With an IVI driver calling this
function it will only result in sending the command to set the frequency. IVI State caching provides
that only the changed frequency value is reset.
In addition to being multithread safe, IVI drivers also allow you to simulate an instrument. You can
write an application, run it in simulation mode, and verify the validity of each of your parameters
and therefore the correctness of the application. Once you are comfortable with your application’s
robustness, you can use the application with an actual instrument and deploy your system.
IVI Driver
IVI drivers have a number of similarities with traditional drivers. Like traditional drivers, an
IVI driver must be present for each instrument. They are also VXIplug&play compliant.
Improvements introduced through the IVI standard have lead to more consistent and higher quality
drivers.
IVI has several built-in features for meeting the most advanced test development requirements:
• A state caching engine eliminates redundant instrument I/O
• Range checking validates values for attributes before they are configured on the instrument
• Error checking to query the instrument’s error queue
• Built-in simulation capabilities
• Multithread-safe drivers
• Standard attribute model and APIs for various types of instruments
• Driver development tools
• Instrument interchangeability
• Consistent driver architecture
• Usable in LabWindows/CVI, LabVIEW, Visual Studio, and so on
ATTR_TRIGGER_SOURCE
ATTR_VERTICAL_RANGE
ATTR_VERTICAL_COUPLING
ATTR_INPUT_IMPEDANCE
ATTR_VERTICAL_OFFSET
ATTR_HORZ_TIME_PER_RECORD
A standard attribute model also implies that you can develop a software layer that allows
instruments with similar capabilities to be interchanged without changing the test code.
State Caching
The attribute model of IVI drivers is key to implementating state caching. Each physical state or
attribute of an instrument is maintained as an attribute in a software cache. High level functions
group together a number of attributes and communicate with an instrument only when a particular
cached attribute value becomes invalid. This eliminates both redundant I/O and instrument
re-configuration.
Range Checking
IVI drivers verify the values for an attribute such as range in software, and return errors before
communicating with the instrument. Traditional drivers document valid ranges for parameters or
settings but do not provide error checking or trapping themselves.
IVI drivers also take into account any attribute inter-dependencies. For example, the valid vertical
range for an oscilloscope is usually dependent upon the probe attenuation for the probe that is
connected to a particular channel. IVI drivers can dynamically calculate the valid vertical range by
checking the probe attenuation.
Simulation
Simulation eliminates the need to have an actual instrument present when developing an
application. With range checking and simulation the application developer can verify the
correctness of the test application before even purchasing the instrument or deploying a system on
a test floor.
Simulation allows the application developer to verify the values being sent to the instrument
through range checking, and also simulate the data being returned from instruments. Thus the test
application developer can write the entire application, test it through simulation, and spend very
little time testing with the actual hardware before deploying the system.
Standardization
The IVI class specifications are determined by the IVI foundation (www.ivifoundation.org).
The class specifications set guidelines for the internal structure and programmatic interface of
similar instruments. Thus IVI drivers provide the application developer with a consistent,
standardized programming model.
Instrument Classes
The “interchangeable” side of IVI drivers has been made possible by the standardization of the
internal structure of instrument drivers. Instrument classes define a function set that must be
present.
The IVI class specifications divide instrument features into fundamental capabilities and extension
groups.
Fundamental capabilities are attributes and functions that are commonly supported by the majority
of instruments in a class (for example, range setting for a DMM or probe attenuation for a scope).
This defines the basic functionality that can be interchanged among instruments in a particular
class.
Extension groups are for less common features that are popular in a large number of instruments
(for example, different scopes have different triggering protocols, so glitch triggers, runt triggers,
and so on are considered extension groups).
Fundamental Capabilities are common functions, attributes, and attribute values supported by more
than 95 percent of the instruments of a given class, that must be implemented in all
instrument-specific IVI drivers in the class. Extensions are less common capabilities and optional
(for example, the Arb extension is supported only by true arbitrary waveform generators).
Two examples that show the difference between fundamental capabilities and extensions are
described here in reference to the Scope and DMM class drivers:
• The Scope class defines the vertical and horizontal subsystems as part of the fundamental
capabilities. Different oscilloscopes support different triggering mechanisms and protocols,
and the Scope class defines the most common as extended features.
• The DMM class defines trigger and multipoint measurement functions as extended capabilities.
Less common features such as autoranging capabilities and measurement functions such as
light intensity are also included in the extensions.
IVI is also based on VXIplug&play, but it extends the standard by defining a template for the
internal structure of drivers. It also introduces an attribute-based model that allows you to
implement advanced features.
IVI drivers maintain the flexibility of traditional drivers and address the areas where traditional
drivers were lacking. IVI drivers allow you to develop more consistent and better performing
applications.
The IVI layer itself is divided into two sub-layers. The lower is the IVI-specific driver layer.
These are instrument-specific drivers that are intended to be used with specific instrument models,
and they are designed to provide the performance improvements of IVI, such as state-caching,
multithreading, and simulation.
The upper sub-layer is the IVI class driver layer. These are the generic class drivers that you can
use in conjunction with specific drivers to control any instrument in a class. This layer provides the
interchangeability benefit of IVI.
The IVI specs also allow drivers to be created for instruments that do not fall into one of the IVI
defined classes. Users can develop specific drivers to take advantage of performance benefits or
define their own instrument class.
The main difference between traditional drivers and IVI drivers is that IVI drivers have two
Initialize functions. The first is the same as traditional drivers and the second is the “Initialize with
Options” VI or function. This VI or function includes one parameter, called the “option string”
which the traditional Initialize VI or function does not contain. The option string can be used to
specify which of the IVI driver features you wish to enable or disable.
An example is “Simulate=0,RangeCheck=1,QueryInstrStatus=1,Cache=1,
DriverSetup=Model:E3633A”:
1. Does not simulate the instrument.
2. Does check the range or value of attributes.
3. Does Query the instrument status
4. Does maintain the State Cache.
5. Sets the driver to talk to a E3633A model (In this case HPE3633A)
Test Program
• Swap instruments (LabWindows/CVI, LabVIEW, VB, etc.)
under generic class
drivers
– No source code change
or recompilation DMM Class
• Five classes defined Driver
– Scope
– DMM
– Arb or function generator
– Switch NIKeithley
Fluke 45
4050 2001
DMM
– DC power supply
Interchangeable Drivers
Test programs can call driver functions contained in either a specific driver or a class driver.
Programs developed with the generic class driver functions are hardware independent; you can use
them with any instrument that has an IVI driver for the particular class (provided the instrument
meets the test system specifications). Test programs can call a specific driver directly, call a generic
driver to allow interchangeability, or mix calls to the specific and class drivers to take advantage of
features the class driver does not expose.
Class Driver
(Scope, DMM, Switch, etc.)
IVI Engine
Instrument Driver
(fl45, hp54600, VXI-DAQ, Plug-In DAQ)
Instrument-Specific Capabilities
IVI Configuration
IVI Architecture
Test applications can make calls to a class driver, a specific driver (if interchangeability is not
important), or both. Both the class and instrument-specific drivers rely on the IVI engine for state
management. The class drivers also use entries in an IVI configuration file to direct the generic
class driver calls to the specific instruments in use.
IVI Configuration
You configure your IVI instruments with the IVI configuration utility that is added into the
Measurement & Automation Explorer (MAX). The graphic above shows the IVI section of MAX.
You can configure the following settings with the IVI configuration utility:
• Logical Names—A logical name references the virtual instrument you want to use in your
application.
• Virtual Instruments—The combination of the physical instrument, the instrument driver, and
option settings. You can swap instruments without changing your program by changing the
Logical Name to reference a new virtual instrument.
• Simulation Virtual Instrument—A particular simulation driver and the initial attribute
settings for the driver.
• Instrument Drivers—An IVI specific driver configuration item that specifies a code module,
such as a DLL, for a specific driver.
• Class Drivers—An IVI Class driver configuration item that refers to a default simulation
virtual instrument. The class driver uses the default simulation virtual instrument when you
enable simulation.
• Simulation Drivers—An IVI simulation driver configuration item that specifies a code
module, such as a DLL, that a class driver can use to simulate a device.
• Devices—An IVI device configuration item that specifies the address of an instrument to use.
IVI Configuration
With MAX, you can configure the following:
• Logical names—A logical name references the virtual instrument you want to use in your
application. A virtual instrument is the combination of the physical instrument, the instrument
driver, and option settings. By changing the virtual instrument logical name references, you can
swap instruments without changing your program.
• Virtual channel names—Virtual channel names aliases for instrument-specific channel
names. By using virtual channel names, your program does not contain instrument-specific
channel names.
• Default setup—You can define a list of attributes and their values. After the class driver calls
the specific driver initialize function, these attributes are set to the specified values. With this
feature, you can set instrument-specific attributes outside your program. This feature has two
benefits—it configures the instrument so that it behaves interchangeably, and it maximizes the
possibility of changing instruments.
• Inherent Attributes—You can specify whether attributes such as range checking, state
caching, query instrument status, spy, interchange check and record coercions are enabled
or not.
Logical Names
When you call a class driver Initialize function, you pass a logical name alias rather than a resource
descriptor to identify the particular virtual instrument to use. Logical names are used by the class
drivers to isolate the test code from the specific instruments in use and point to the specific
instruments that are being used via a configuration file. For example, a frequency response
program can access instruments with the logical names of “DMM” and “FGEN” without worrying
about which model is actually used. Whether the DMM is an HP34401A or a Fluke 45 can be
configured in MAX.
Logical names are assigned to a specific virtual instrument configuration entry point. Each virtual
instrument configuration entry contains information regarding the instrument model, address,
instrument driver location, and so on.
Virtual instruments assigned to a logical name can be changed by right-clicking on a virtual name
and selecting properties.
• Identify a specific
model in a driver that
supports several
different instrument
models in a family
Virtual Instruments
The logical name for an instrument references a virtual instrument. The virtual instrument used for
configuring IVI class drivers here is not the same as a virtual instrument (VI) in LabVIEW. Here, a
virtual instrument is the combination of settings for a particular instrument associated with a
specific logical name.
The window above shows the properties that can be configured for a virtual instrument.
The tktds3x0, a virtual instrument, is associated with the tktds3x0 IVI-specific driver and to no
physical device.
Class drivers use the Specific Driver Options field to associate a particular instrument with a
“family” driver.
• Configure the
instrument specific
driver to point to:
– Driver module (DLL)
– Function prefix (e.g.,
hp33120a_init)
– Instrument’s IVI class
(e.g., IviFgen)
Once you select your driver, Function Prefix, and Class it should be populated with the respective
prefix and class. In the above case the prefix is hp33120a which belongs to the function generation
class. The function prefix is used to call functions within the driver.
Device Configuration
The last step is for you to describe the device and interface information for each instrument. For the
example shown above, the Tektronix TDS220 scope is connected to the GPIB bus and has a
primary address of 1. Therefore, the Resource Descriptor is “GPIB::1::INSTR”. You can
determine the GPIB address of an instrument using the Measurement and Automation Explorer.
Examples of the Resource Descriptor string for other interfaces are shown at the bottom of this
window and are described in more detail in the IVI Driver Library User Manual.
Inherent Attributes
The Inherent Attributes tab contains the settings for the various IVI software attributes. The IVI
class drivers do not contain an Initialize With Options VI, so the attributes such as state-caching,
range checking, and query instrument status are set with check boxes in the configuration window.
• Used as aliases to
instrument-specific
channel names
• Configured via channel
tab in Virtual instrument
properties dialog
Virtual channel names allow you to associate descriptive names with instrument-specific channels.
Virtual channel names are configured for each driver in the system and isolate the test code from
the specific channel naming conventions (such as CH1) each driver uses. You should use virtual
channel names whenever you want to develop hardware-independent test programs.
• Configured via
instrument driver
properties dialog
Default Setup
The Default Setup tab is used to configure instrument attributes from outside a program. You
generally use the Default Setup to configure attributes that must be set for a particular instrument,
but that may not be available for other instruments in that class.
For example, you are using a four-channel oscilloscope in an application that uses only two
channels. Since you are not going to refer to two of the four possible channels, you can disable
them by using the Default Setup.
In addition, the Foundation’s membership roster has been expanding steadily from nine founding
members to more than 50 current members. The membership includes end-user companies,
systems integrators, as well as all major instrument and software vendors, including National
Instruments, Agilent Technologies, Tektronix, and Rohde & Schwarz.
With the experience of developing and revising the first set of instrument classes, the Foundation
has now turned its attention to defining new instrument class specifications such as RF signal
generators, spectrum analyzers, power meters, digital instruments, and AC power supplies. In
addition, the Foundation will look into defining interfaces for the latest in software component
technology, starting with the current drive to define a COM interface.
If you find errors in the manual, please record the page numbers and describe the errors.
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
____________________________________________________________________________________________
Instructor
Please evaluate the instructor by checking the appropriate circle. Unsatisfactory Poor Satisfactory Good Excellent
Course
Training facility quality ❍ ❍ ❍ ❍ ❍
Training equipment quality ❍ ❍ ❍ ❍ ❍
Was the hardware set up correctly? ❍ Yes ❍ No
The course length was ❍ Too long ❍ Just right ❍ Too short
The detail of topics covered in the course was ❍ Too much ❍ Just right ❍ Not enough
The course material was clear and easy to follow. ❍ Yes ❍ No ❍ Sometimes
Did the course cover material as advertised? ❍ Yes ❍ No
I had the skills or knowledge I needed to attend this course. ❍ Yes ❍ No If no, how could you have been better
prepared for the course? _________________________________________________________________________
_____________________________________________________________________________________________
What were the strong points of the course? __________________________________________________________
_____________________________________________________________________________________________
What topics would you add to the course? ___________________________________________________________
_____________________________________________________________________________________________
What part(s) of the course need to be condensed or removed? ____________________________________________
_____________________________________________________________________________________________
What needs to be added to the course to make it better? ________________________________________________
_____________________________________________________________________________________________
Are there others at your company who have training needs? Please list. ____________________________________
_____________________________________________________________________________________________
_____________________________________________________________________________________________
Do you have other training needs that we could assist you with? _________________________________________
_____________________________________________________________________________________________
How did you hear about this course? ❍ National Instruments web site ❍ National Instruments Sales Representative
❍ Mailing ❍ Co-worker ❍ Other _____________________________________________________________