Using a TestStand Environments File

Updated Oct 31, 2023

Environment

Software

  • TestStand

TestStand environments enable two or more TestStand system configurations to exist side-by-side on a single system. They can also be used to replicate a TestStand environment on other machines.

In this tutorial, we will look at using environments to control TestStand Types, Station Globals, and Station Model capabilities.

Requirements

  • TestStand 2016 or later
 

TestStand Environments Demo

1. Download the attached .zip file, which contains a .tsenv file and three directories. Unzip the contents to any directory that works best for your system.
2. Open the TestStand Sequence Editor.
  • First note that TestStand launches with a default environment, <Global>, which is denoted in the status bar at the bottom:


3. To change the environment to this tutorial's environment, on the tool bar menu, navigate to Configure>>Environment... 
4. In the Configure Environment dialog, browse to the DemoEnvironment.tsenv file. The dialog will populate with the custom directories used by this environment.

5. Click Set Engine Environment. Since the TestStand Engine needs to be reinitialized with the new environment settings, you will need to click OK on the following dialog: 
6. If you are using a version later than TestStand 2016, three additional dialogs will appear indicating that this example is out of date. The first dialog that appears is shown below:
  • Click OK. Two more dialogs will appear indicating that the layout_current.bin is again out of date and that the default analyzer project is out of date. Click OK on both dialogs to open the example TestStand environment.
7. The status bar will now display Environment: DemoEnvironment.tsenv
  • Notice that the Station Model is different for this environment.  It is now ParallelModel.seq:


8. Environments allow you to personalize the Sequence Editor (or the instance of the engine in general). One aspect that can be customized is the Types available for the user in the given environment.
  • For more information on environments, see TestStand Help: TestStand Environments.
  • This demo environment has its own specific Type Palette. Navigate to MyTypes.ini the types view. Notice that under Step Types and Custom Data Types, there are two different types called CustomDemoStepType and CustomDemoDataType respectively.


Note: The owning Type Palette is MyTypes.ini. Hover over MyTypes.ini, and you can see that the file is contained in DemoPublic, the TestStand public directory for the demo environment:



9. In the Variables Pane, expand StationGlobals. There will be an addition Station Global called DemoEnvironmentSG:



10. Launch another instance of the Sequence Editor.
  • The default behavior is to launch with the <Global> environment.
  • Compare the Station Globals and the Types in MyTypes.ini. Notice how CustomDemoStepType, CustomDemoDataType and the DemoEnvironmentSG Station Global are not in the <Global> environment.

This section demonstrated the basics of a TestStand environment and a use case for it. You can build from this demo, or start fresh. The following section will indicate how to create a custom TestStand environment. 
 

Creating a .tsenv File

A .tsenv file defines a TestStand environment. It is an INI text file that can specify the TestStand Public directory, TestStand Application  (CommonAppData) directory (which implicitly defines the TestStand Configuration directory), and/or the TestStand Local Application (LocalAppData) directory. For more information, see TestStand Help: TestStand Environments.


There are two methods to create a TestStand environment. The first method is to create the file manually using a text editor, and the latter is to use the Sequence Editor to create the .tsenv file.
 

Creating .tsenv From a Text Editor

  1. Create a .tsenv file by creating a text file and changing the extension to .tsenv
    • Note: Ensure that you can see the extension of your file to guarantee that the file’s extension has been changed.
  2.  Insert the following section and keys:

    [TestStandPaths]
    CommonAppData = "EnvironmentRoot\\DemoCommonAppData"
    LocalAppData = "EnvironmentRoot\\DemoLocalAppData"
    Public = "EnvironmentRoot\\DemoTestStandPublic"

     
    • The paths can be absolute or relative to the environment root directory. The paths shown here are relative to the directory of the .tsenv file. For deployment of your TestStand system, the paths to each folder must be relative.
    • Note: You do not have to specify all of the folders. If you wish to share a default folder of the TestStand Global Environment, omit the key or set it to an empty string.
       
  3. Load the environment file into TestStand. In the Sequence Editor, go to Configuration>>Environment. Click on “” and browse to your environment file.
  4. When your file has loaded, ensure that the folders that you wish to map your environment to appear as intended. Click Set Engine Environment to relaunch TestStand in the new environment.
 

Creating .tsenv from TestStand 

  1. Navigate to Configure>>Environment. In the Environment Path text box, replace “<Global>” with an absolute path to an environment file such as C:\Users\Public\Documents\DemoEnv.tsenv and click Save. TestStand will create a DemoEnv.tsenv file in the location specified.
  2. In the Custom Directories group box, check any directory and enter a name for the folder.
    • If there is a folder on disk that you want to use, then you can click on “” and browse to that folder. Click Save to save the environment file.
  3. Click Set Engine Environment to load this new environment file and to personalize your environment.
    • TestStand will create any missing custom folders and populate them with the default configuration files as necessary.