Importing and Exporting TestStand Comments to a File

Updated Nov 2, 2023

Environment

Software

  • TestStand

Before proceeding, ensure that a TestStand™ Development License is activated on the PC. Screenshots from TestStand 2020 are used throughout this article, but older versions of TestStand can also be used.

This article will detail the necessary steps to import and export comments between TestStand and a destination file. For demonstration purposes, this articles will use a .CSV file.
To export:
  • The steps explain how to use the Description of a Label step as a comment inside a .CSV file.
To import:
  • The steps explain how to use the Import/Export Properties tool to import comments into a Label Description.
  • An additional method is described, which allows users to import comments into the Comment property of a Local Variable.

In TestStand, only the Label Step Type can be exported/imported as a comment. The Comment property of a variable is not accessible from the Import/Export Properties tool, and therefore, cannot be exported. However, a string from a file can be imported and assigned to the Comment property of a variable. An example of this is outlined below.


Exporting Comments

1. In TestStand, add a Label Step to the Sequence.
  • Drag and drop the Step from the Insertion Palette onto the Sequence, as shown.

Label step.png
 

2. In the Label Description of the Step Settings, add a comment.
  • This is what will be exported to the .CSV file.

Label Description.png

3. Navigate to Tools >> Import/Export Properties... 
4. In the pop up window, select the Export section.
5. In the Export Options tab, choose the required file type in the Destination Type (a .CSV file is selected for this example).
6. Define the location to save the file in the Destination Location option. 

Export Options.png

7. Navigate to the Property Selector tab.
8. Expand the [0] MainSequence >> Main >> [0] Label branch and enable the Description property, as highlighted below.

Property Selector.png

9. Click Export.

 

Importing Comments

There are multiple ways to import comments into TestStand. This article will demonstrate the following two:
  • Using the Import/Export Properties tool.
  • Using a Property Loader step.
    • Note that this method can be used to dynamically load comments into the Comment property of a TestStand variable.

Using the Import/Export Properties Tool

1 . Navigate to Tools >> Import/Export Properties... 
2. In the Import section, select the type of file to be imported in the Source Type option.
  • In this example, a .CSV file will be imported.
3. Select the location of the file using the Source Location option, as shown below.

Import Options.png

4. Click Import.
  • Alternatively, click Preview to view a comparison list of the properties that will change if the file is imported.

Using a Property Loader Step

1. Place a Property Loader step from the Insertion Palette into the Sequence.
  • This can be done by dragging and dropping it, as shown.
Property Loader Step.png

2. In the Step Settings of the Property Loader, browse for the file to import.
  • By default, the Property Loader will import all properties from the file. This can be changed by disabling the Import All Properties From Source checkbox.
Property Loader Step Settings.png

3. The properties will be imported when the Sequence is executed.

Optional Steps to Set the Comment Property of a Variable:

Note that doing this will only overwrite the Comment property for the duration of the sequence execution. 

4. In the Properties tab of the Step Settings, select the Expressions menu item.
5. Define a Post-Expression that will assign the imported value to the Comment property of a variable.
  • In this example, we assign the Description of the Label step to the Comment property using the below expression:
  • Locals.NumberVar.Comment = RunState.Sequence.Main["Label"].Description

Post Expression.png

6. The Comment property will update after the Property Loader step has executed.