您可以捐助,支持我们的公益事业。

1元 10元 50元





认证码:  验证码,看不清楚?请点击刷新验证码 必填



  求知 文章 文库 Lib 视频 iPerson 课程 认证 咨询 工具 讲座 Model Center   Code  
会员   
   
 
     
   
 订阅
  捐助
手把手教你创建Teststand User Interface
 
  16680  次浏览      16
 2019-3-26
 
编辑推荐:

本文来自于NI官网,本文主要介绍了如何使用labview来创建teststand界面,希望对您的学习有所帮助。

问题: Teststand是NI的自动化测试管理软件,广泛使用在自动化产线中,在很多场合下,开发工程师不希望现场的操作技术人员看到Teststand的底层代码,避免其误操作导致问题,这时候需要编写一个用户界面即User interface(以下简称UI),使用UI可以直接调用Teststand来完成相关的自动化测试。

解答:

创建Teststand Ui的方法很多,可以使用Labview, 也可以使用CVI,C,C#等,在开始菜单中可以发现,NI提供了丰富的程序以及源代码。

这里仅以Labview为例介绍如何创建Teststand UI。例如,需要创建如下图所示的一个UI:

相对应的,大家可以在上图发现相应的前面板要素:

下拉框:Sequence files;Sequence;

按钮:Open/close Sequence files;TestUUT/single pass/Run mainseq;

显示框:Execution display,Report;

这里需要提到的是,在Teststand的UI Controls 被分为两大类: visible controls和manager controls。这两种controls都基于ActiveX,可以完成显示,执行,编辑,保存和调试sequences的工作。 前者visable controls主要分为四种View Controls,Selector Controls,Text Display Controls和Command Controls,通常会被显示给最终用户,也就是你现在所看到的。而在前面板的其他地方还有一些没有被显示的隐藏要素,就是manager controls。

Manager controls 调用 TestStand API 来完成相应的任务,例如载入序列文件,执行测试步骤等。

Manager controls 可管理或提醒事件发生, 例如用户登录, 执行到断点或者用户修改了序列文件。 Manager controls 在编辑时可见,运行时自动隐藏。Manager controls有三种,分别是Application Manager,SequencefileView Manager和ExecutionView Manager。

Application Manager control 使用Teststand engine提供如下最基本的操作。

1.Processes command-line arguments.

2.Maintains an application configuration file.

3.Initializes and shuts down the TestStand Engine.

4.Loads type palette files at initialization.

5.Logs users in and out.

6.Loads and unloads sequence files.

7.Launches executions.

8.Tracks existing sequence files and executions.

SequenceFileView Manager control管理Teststand UI visable Control如何与sequence file交互。一个应用程序对每一个Sequence file都必须有一个 SequenceFileView Manager control, 这样可以显示 sequence file 或让用户来选择一个 sequence file,提供如下最基本的操作:

1.Designates a sequence file as the selected sequence file.

2.Tracks which sequence, step group, and steps users select in the sequence file.

3.Tracks which variables or properties users select in the sequence file.

4.Displays aspects of the sequence file in the visible TestStand UI Controls to which the SequenceFileView Manager control connects.

5.Enables visible TestStand UI Controls to which the SequenceFileView Manager control connects to change the selected file, sequence, step group, and steps.

6.Provides editing and saving commands.

7.Provides methods for executing the sequence file users select.

ExecutionView Manager control 管理visible TestStand UI Controls 如何与被选择的 TestStand execution进行交互。一个应用程序对每一个execution都需要一个ExecutionView Manager control,这样可以显示execution或让用户来选择一个execution,提供如下最基本的操作。

1.Designates an execution as the selected execution.

2.Tracks which thread, stack frame, sequence, step group, and steps users select in the execution.

3.Tracks which variables or properties users select in the execution.

4.Displays aspects of the selected execution in the visible TestStand UI Controls to which the ExecutionView Manager control connects.

5.Enables visible TestStand UI Controls to which the ExecutionView Manager control connects to change the selected thread, stack frame, sequence, step group, and steps.

6.Sends events to notify the application of the progress and state of the execution.

7.Provides debugging commands.

8.Updates the ReportView control to show the current report for the execution.

Teststand UI controls和Teststand Sequence editor中名词术语的对应关系的相关可参考下图:

上文所述的Manager controls可以在控件选板中找到:

程序框图对应的接线端如下:

同样,Visable controls也可以在Teststand的子选板中找到,拖曳到前面板如下图:

无论是Manager controls还是visable controls都有很多的属性和方法供外部程序进行调用。在进行程序框图的编程之前,我们首先打开Teststand中自带的UI范例Load Top-Level VI.vi(C:\ProgramData\Microsoft\Windows\Start Menu\Programs\National Instruments\TestStand 2010 SP1\User Interfaces\LabVIEW\Source Code),来看看它的组成部分,下图是UI的VI层次关系图:

可以看到,即使一个简单的UI,其VI的层次结构也是非常复杂的,但仔细看来,其调用的很多子VI都是labview所自带的。

如图,白底的VI是调用C:\Users\Public\Documents\National Instruments\TestStand 2010 SP1\UserInterfaces\Full-Featured\LabVIEW路径下TestExec.llb中的Full UI。其余的基本为C:\Program Files\National Instruments\LabVIEW 2011\vi.lib\addons\TestStand中_TSUISupport.llb和_TSUIControls.llb中的相关VI。编程时,只需要我们了解这些VI的作用并合理的使用即可。

下面我们来看UI程序框图的处理。

1、首先是对UI前面板控件的相关配置,如下图分为六步:

首先调用Set Teststand Application Window VI,配置Teststand UI App Manager,之后的五步使用方法节点分别对sequence file,entry point, sequence, ExecutionView control 和 ReportView control进行配置。

需要注意的有几点,

① 方法节点的创建如下图:

① 第三步Entry point的index默认为0,即使用第一种process model。

2、创建用户事件,并将ApplicationMgr,SequenceFile View Mgr和Execution View Manager进行捆绑。

3、完成事件的注册和程序的开始:

4、创建事件结构,可根据实际情况进行创建,此例程仅仅简单的创建了两个事件分支,分别针对前面板关闭和设置鼠标为忙碌状态。

5、最后完成事件的取消注册和销毁。

总结:

本文仅仅介绍了如何使用labview来创建teststand界面,使用其他语言环境也十分类似,都是调用Teststand UI controls的属性节点和方法节点来完成。

 

 

 
   
16680 次浏览       16
相关文章

微服务测试之单元测试
一篇图文带你了解白盒测试用例设计方法
全面的质量保障体系之回归测试策略
人工智能自动化测试探索
相关文档

自动化接口测试实践之路
jenkins持续集成测试
性能测试诊断分析与优化
性能测试实例
相关课程

持续集成测试最佳实践
自动化测试体系建设与最佳实践
测试架构的构建与应用实践
DevOps时代的测试技术与最佳实践