TestStand系列----1初识TestStand

本文介绍了21世纪产品快速更新对自动化测试的需求,重点讲解了TestStand测试系统的架构,包括仪器设备、测试站、驱动程序、开发环境和测试管理软件。TestStand以其通用测试架构、图形化界面和多语言支持等特点,提升了测试效率和简化了软件开发工作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

       进入21世纪,产品更新换代以前所未有的速度进行更新,涵盖电子、汽车、医疗、半导体、航空航天等,这些领域每天可能都会有大批大量的产品问世,接踵而至的就是对它们进行大批量的测试,传统的手动使用仪器进行测试显然是不现实的,必须使用更加高效的测试方式,提高测试效率。在一个以软件为中心的时代,软件控制硬件的自动化测试系统应运而生。

       一个标准的自动化测试系统架构包含五层,从低到高分别为:仪器设备、测试站、仪器驱动程序、应用开发环境、测试管理软件。仪器设备可以使PXI模块、VXI模块、GPIB总线接口仪器;测试站可以是桌面PC、工控机或基于标准总线平台;仪器驱动程序是用于控制可编程仪器的一个软件程序集,常见的标准方法有即插即用驱动PnP、可互换虚拟仪器驱动IVI、直接IO;应用开发程序是具体的测试代码开发环境,包括LabVIEW、C#、C++等,开发过程中应着重设计高度模块化且可重用的代码模块;测试管理软件位于五层结构模型的最上层,用于管理和执行测试,应用开发环境编写的每个测试代码都作为测试管理软件的一个步骤,对应一个具体的测试项,测试管理软件将这些步骤排列起来形成序列,并按最终定义的顺序序列执行,从而实现自动化测试。同时,代码模块有可能是不同语言编写的,这在自动化测试中很常见,因此测试管理软件需要有接口能够同时识别这些代码模块。TestStand不仅能实现上述描述,还可实现并行测试,提高测试效率。

TestStand特点归纳如下:

  1. 测试管理和执行;
  2. 通用测试架构,简化测试软件开发工作;
  3. 具有图形化操作界面;
  4. 支持主流应用开发环境编写的代码模块;
  5. 支持多线程并行测试;
  6. 内建测试策略;
  7. 具有自定制的用户界面设计;
  8. 具有开放式的架构,可自定制;
  9. 自动生成ASCII、HTML、XML、ATML报表;
  10. 支持与Access、Oracle、SQL Server数据库互连。

 TestStand架构概览

Step:测试最小单元,它可以采用以下任意一种实现形式:弹出对话框、流程控制、计算表达式等TestStand、内部定义的操作;调用应用开发环境编写的代码模块;调用其他测试子序列。

代码模块:一个Step可以调用不同应用开发环境编写的代码模块,TestStand能解析代码模块,既能传入数据,也能获取返回值。目前TestStand支持LabVIEW、LabWindows/CVI、C/C++、.NET、ActiveX/COM、HTBasic等语言。

序列:序列是一系列步骤的有序组合,将不同的步骤按顺序排列,就形成了一个序列。通常,测试序列将包含多个测试序列。

步骤组:为了更好地对步骤进行组织,TestStand将每个序列分成三个步骤组,分别是设置组、主体组、清理组。每个步骤组里面包含一系列步骤。

  1. 设置组;一般包含初始化仪器、冶具、待测件,以及资源分配的步骤。
  2. 主体组:即序列的主体部分 ,包含大部分步骤,如待测件的测试。
  3. 清理组:通常包含关闭系统电源、恢复测试仪器、冶具、待测件到初始状态、资源的释放和关闭等操作。

设置组和清理组可以为空,即不包含任何步骤。 

序列文件:TestStand树状结构的最顶端是序列文件。一个序列文件中可以包含多个序列。外边的序列是主序列,被调用的序列成为子序列。

TestStand序列编辑器主界面布局

安装完TestStand进入后,会弹出一个登录窗口,TestStand默认创建一个名为“Administrator”密码为空的管理员权限的账户,单机OK按钮就可以登录进去,无需输入密码。TestStand主界面如下图所示。

界面显示的各项在后面的介绍中将会一一涉及,此处暂不赘述。另外TestStand有三个重要的目录包含TestStand的范例以及重要的文件。

<TestStand>     C:\Program File (x86)\National Instruments\TestStand x.x

<TestStand Public>     C:\Users\Public\Documents\National Instruments\TestStand x.x

<TestStand Application Data>     C:\Program Data\National Instruments\TestStand x.x  默认隐藏

最全的Teststand 教程(英文版) Introduction Introduction.................................................................................................................xi Technical Support Options.........................................................................................xii Course Objectives.......................................................................................................xiii Course Description .....................................................................................................xiii Course Map.................................................................................................................xiv Items You Need for this Course Module:...................................................................xv Note on Hands-On Exercises......................................................................................xvi Lesson 1 Introduction to TestStand Introduction.................................................................................................................1-1 The Role of a Test Executive......................................................................................1-2 The TestStand Goal ....................................................................................................1-3 What is TestStand?.....................................................................................................1-4 The TestStand Architecture........................................................................................1-5 The Sequence Editor...................................................................................................1-6 The Operator Interface................................................................................................1-7 The TestStand Engine.................................................................................................1-8 Module Adapters ........................................................................................................1-9 The TestStand Architecture........................................................................................1-10 Summary.....................................................................................................................1-13 Exercises Exercise 1-1 Running a Sequence File..................................................................1-15 Exercise 1-2A Running a Sequence File from the LabVIEW Operator Interface ............................................................................1-20 Exercise 1-2B Running a Sequence File from the LabWindows/CVI Operator Interface..............................................1-25 Contents TestStand Development Course Manual iv www.ni.com 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 Model.....................................................................................2-8 The Default Process Model: Test UUTs Mode ..........................................................2-9 TestStandModel.seq....................................................................................................2-10 The Role of the Process Model within the TestStand Architecture............................2-11 Exercises Exercise 2-1 Understanding the Sequence File.....................................................2-15 Exercise 2-2 Running a Sequence File with Breakpoints and Single Stepping.................................................................................2-21 Exercise 2-3 Understanding the Process Model....................................................2-28 Lesson 3 Creating Sequences Introduction.................................................................................................................3-1 How to Create Test Sequences ...................................................................................3-2 Action 1 : Specify the Adapter ...................................................................................3-3 Action 2: Select the Step Type ...................................................................................3-4 Step Types...................................................................................................................3-5 Action 3: Specify the Test Module.............................................................................3-6 Specifying the Module................................................................................................3-7 Specifying the Module: Search Directories................................................................3-8 Action 4: Configure Step Properties...........................................................................3-9 Step Properties: General Tab......................................................................................3-10 Step Properties: Preconditions....................................................................................3-11 Step Properties: Run Options......................................................................................3-12 Step Properties: Post Actions......................................................................................3-14 Step Properties: Loop..................................................................................................3-15 Step Properties: Expressions.......................................................................................3-17 Exercises Exercise 3-1 Creating Steps in the Sequence Editor .............................................3-23 Exercise 3-2 Configuring Loop Options ...............................................................3-34 Exercise 3-3 Creating a Sequence.........................................................................3-38 Exercise 3-4 Running Sequences in Parallel (Optional) .......................................3-58 Contents © National Instruments Corporation v TestStand Development Course Manual Lesson 4 TestStand Parameters, Variables, and Expressions Introduction.................................................................................................................4-1 Parameters...................................................................................................................4-2 Parameters: Passing data from top-level sequences to subsequences.........................4-3 TestStand Variables....................................................................................................4-4 Local Variables...........................................................................................................4-5 Creating Locals Variables...........................................................................................4-6 Sequence File Global Variables..................................................................................4-8 Creating Sequence File Global Variables...................................................................4-9 Station Globals............................................................................................................4-10 The Expression Browser.............................................................................................4-11 Exercises Exercise 4-1 Using Local Variables......................................................................4-19 Exercise 4-2 Examine the Uses and Differences between Locals, File Globals, and Station Globals.....................................................4-22 Exercise 4-3 Using Expressions to Change Step Properties..................................4-30 Exercise 4-4 Passing Parameters...........................................................................4-39 Exercise 4-5 Dynamically Selecting Which Sequence to Run..............................4-49 Exercise 4-6 Using the UUT Serial Number to Determine Which Sequence to Run...............................................................................4-50 Lesson 5 Creating Test Modules in External Environments Introduction.................................................................................................................5-1 Creating Tests in External Application Development Environments (ADEs)...........5-2 Methods of Data Transfer for TestStand ....................................................................5-3 Method 1—Passing Parameters Directly Using Structures........................................5-3 Using Clusters to Pass Data from LabVIEW..............................................................5-4 Using Structures to Pass Data from LabWindows/CVI..............................................5-6 Method 2—Passing Arbitrary Number of Parameters Directly..................................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 Using TestStand ActiveX Automation Functions in LabVIEW.................................5-16 An Example of Using ActiveX Automation in LabVIEW.........................................5-17 Using ActiveX Automation in LabWindows/CVI......................................................5-18 An Example Of Using The TestStand API Instrument Driver In LabWindows/CVI.....................................................................................................5-19 Using TestStand to Generate Code Templates...........................................................5-24 Code Templates ..........................................................................................................5-25 Contents TestStand Development Course Manual vi www.ni.com Exercises Exercise 5-1A Creating Pass/Fail Tests in LabVIEW..............................................5-27 Exercise 5-1B Creating Pass/Fail Tests with LabWindows/CVI.............................5-33 Exercise 5-1C Creating Pass/Fail Tests for the DLL Flexible Prototype Adapter.............................................................................5-44 Exercise 5-2A Creating Numeric Limit Tests with LabVIEW................................5-54 Exercise 5-2B Creating Numeric Limit Tests with LabWindows/CVI.............................................................................5-59 Exercise 5-2C Creating Numeric Limit Tests for the DLL Flexible Prototype Adapter...............................................................5-67 Exercise 5-3A Debugging Tests Using LabVIEW...................................................5-80 Exercise 5-3B Debugging Tests Using LabWindows/CVI......................................5-84 Exercise 5-3C Debugging Tests that use the DLL Flexible Prototype Adapter.............................................................................5-88 Exercise 5-4A Using the ActiveX API in Code Modules with LabVIEW .................................................................................5-91 Exercise 5-4B Using the ActiveX API in Code Modules with LabWindows/CVI ....................................................................5-100 Exercise 5-4C Using the ActiveX API in Flexible DLL Code Modules............................................................................................5-110 Exercise 5-5A Creating a Simple Test Using the LabVIEW Standard Prototype Adapter .............................................................5-122 Exercise 5-5B Creating A Simple Test Using The C/CVI Standard Prototype Adapter .............................................................5-124 Exercise 5-6A Passing Parameters from TestStand to LabVIEW using The TestStand API..................................................................5-125 Exercise 5-6B Passing Parameters from TestStand to LabWindows/CVI using The TestStand API...................................5-127 Exercise 5-7 Passing Data Between TestStand and a Test Module Using the DLL Flexible Prototype Adapter........................5-129 Lesson 6 User Management Introduction.................................................................................................................6-1 The TestStand User Manager .....................................................................................6-2 Default User Profiles in TestStand .............................................................................6-3 Linking Windows System Users.................................................................................6-5 Exercise Exercise 6-1 Setting User Login Access and Privileges........................................6-7 ...............
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

莱布尼兹的眼泪

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值