使用Property Loader Step 将 Excel 内的属性导入TestStand

更新 Nov 8, 2023

环境

软件

  • TestStand

TestStand 中的 Property Loader Step 可将参数属性和变量值动态加载至 TestStand。此外,您可以通过 Property Loader 插件能够支持的文件(如 Excel .xlsx 工作簿文件)导入或导出指定数据,例如范围值和当前参数值。

这个方法对于需要使用特定的参数值来运行 Test Sequence 是非常有帮助的。

本教程将引导大家如何使用 Property Loader Step 把参数属性从 Excel 工作簿导出和导入TestStand。

为了能够通过 Property Loader 读取文件数据,您必须确保所创建的Excel 工作簿使用的语法正确。您可以使用 Property Loader 先导出一个 Excel 文件再修改相关文件的参数以得到一个语法正确的 Excel 文件。

导出Property参数

  1. 创建一个 Test Sequence,加入 Step 并设置参数变量和属性等。

  2. 运行该 Test Sequence 以确保能够成功运行并且没有错误。

  3. 在 TestStand 的工具栏选择 Tools >> Import or export properties...。 

  4. 在新打开的Import/Export Properties...对话框左侧选择Export(导出)。在 Export Options 选择 Destination TypeNI Excel File (*.xlsx),并且在 Destination Location 定义您保存文件的路径。 在Property Selector选择将Test Sequence 中的需要使用到的参数导出到文件。最后点击Export以创建Excel文件。
    注意:属性文件也可以存储为.csv 、 . udl.txt文件(如果需要)。

 


导入Property参数

导入 Property 参数有两种方式:第一种是通过 Import or export properties... 手动添加,第二种是通过Property Loader Step调用。这两种方式都需要确保参数名称和 Excel 文档保存的名称一致。


通过 Import or export properties... 手动添加

  1. 在新的Test Sequence 中加入相关 Step。此 Step 的名称需要和 Excel 文件里的 Category 名称一样。若该 Step 有使用 Module,请加入有关的 Module。若是 Step SettingsValue 使用 Variables,请手动添加该 Variables

  2. 通过 Tools >> Import or export properties... 打开对话框。

  3. 选择 Import 并勾选 Source1

  4. Source Location 浏览到保存 Excel 文档的路径并选择相关 Excel 文档。

  5. 若是您的 Test Sequence 没有添加任何的参数,您需要在 When Property Not Present in Destination 选择 Create。这样才会自动生成相关的参数(Variables)。

 

通过Property Loader 调用

  1. 在新的Test Sequence 中加入Property Loader Step。若是您的 Test Sequence 没有添加任何的参数,您需要在Property LoaderStep Settings >>  When Property Not Present in Destination 选择 Create 以创建相关的参数(Variables)。
  2. 之后再加入相关 Step。此 Step 的名称需要和 Excel 文件里的 Category 名称一样。若该 Step 有使用 Module,请加入有关的 Module。若是 Step SettingsValue 使用 Variables,请手动添加该 Variables