Using a TestStand Environments File

Updated Nov 17, 2020

Environment

Software

  • TestStand

TestStand environments enable two or more TestStand system configurations to exist side-by-side on a single system. 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, and unzip the contents to any directory that works best for your system.
  2. Open the TestStand Sequence Editor. First note that by default TestStand launches with a default environment, <Global>, which is denoted in the status bar at the bottom:
  1. To change the environment to this tutorial's environment, on the tool bar menu, navigate to Configure>>Environment... 
  2. In the Configure Environment dialog, browse to the DemoEnvironment.tsenv file. The dialog will populate with the custom directories used by this environment. For more information on the dialog box, see Teststand Help: Configure Environment Dialog Box.
  1. 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: 
  1. 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:
  1. 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.
  2. The status bar will now display “Environment: DemoEnvironment.tsenv.” Notice that the station model is different for this environment.  It is now ParallelModel.seq.
  1. 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 that 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:
  1. In the Variables Pane, expand StationGlobals. There will be an addition station global “DemoEnvironmentSG”:
  1. 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 My_Types.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 show 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 the 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.