How to Use Multiple TestStand Environments

Question: Is it possible to have separate TestStand environment settings for each project in a single station?

The short answer is Yes! This is possible using the concept of TestStand Environment Settings, where you can have separate TestStand environment setting for each of your projects, without needing to go and tweak the default TestStand Environment settings everytime you switch from one project to another.

TestStand Environment settings can be accessed from TestStand menu Configure -> Environment.

There are 3 directories which together comprise the TestStand Environment. They are

  1. CommonAppData
  2. Public
  3. LocalAppData

Creating a New TestStand Environment

Open Configure Environment via the menu item - Configure -> Environment. Use Save As option to create a new TestStand Environment file, which you can save inside your project directory. 

Configure custom directories for the 3 environment variables.

  1. CommonAppData 
    • <YourProjectRoot>/TSEnv/CommonAppData
  2. Public
    • <YourProjectRoot>/TSEnv/Public
  3. LocalAppData
    • <YourProjectRoot>/TSEnv/LocalAppData

Click Save and click on "Set Engine Environment" to relaunch TestStand with the selected TestStand Environment. Kindly note that any change to the TestStand Environment settings would require restart of TestStand to take effect.

Launching TestStand/OI with Custom TestStand Environment

Whenever TestStand application is launched directly, it will launch with the <Global> TestStand Environment settings.

To manually switch to a different TestStand Environment, one option is to go to Configure -> Environment, choose the required TestStand Environment in the drop down and then click on "Set Engine Environment". This will relaunch TestStand with the chosen TestStand Environment.

The other option is to pass the TestStand Environment file path when launching the TestStand Application, like using a batch file.

Command line Syntax

What if you don't want to do the extra step of passing the command line argument for this? We got that covered in the next section :-)

Directly Specifying the TestStand Environment in your Operator Interface

If you are having a custom TestStand Operator Interface that you want it to always use a custom TestStand Environment, you can use explicitly specify the TestStand Environment path. 

 In the .NET Constructor, choose the Assembly NationalInstruments.TestStand.Interop.API and choose EngineInitializationSettingsClass's constructor. Then use this class's method SetEnvironmentPath to set the TestStand Environment Path. If you pass a empty string, OI will use the TestStand Global Environment.

Kindly note that this needs to be done before the TestStand Engine is initialized and hence needs to be the first piece of code that gets executed when you launch your OI. If you need to change the TestStand Environment after the engine is initialized, you need to restart your OI.

 Have you used TestStand Environment in any of your projects? Let us know in the comments :-)

No comments:

Feel free to leave a piece of your mind.

Powered by Blogger.