Unloading All TestStand Modules Programmatically

Updated Oct 24, 2020

Environment

Software

  • TestStand

I want to unload all TestStand modules programmatically instead of going to File -> Unload All Modules. How can I do this?

For TestStand 4.0 and later:
  • Add a new Statement step to your sequence.
  • Insert the following code into the Expression text box: RunState.Engine.UnloadAllModules().

For TestStand 3.5 and earlier:
  • Select the ActiveX Adapter.
  • Add a new Action Step to your sequence.
  • Right click on the new step and select Specify Module.
  • In the Edit ActiveX/COM Adapter window, set the following fields to the according values:
  1. Object Reference: RunState.Engine.
  2. Automation Server: NI TestStand API <Your TestStand Version> (Ver 1.0).
  3. Object Class: Engine (IEngine).
  4. Action: Call Method.
  5. Method: UnloadAllModules.
  • Click OK to save changes.

You can also call this method by sending the Sequence Context into a code module and using the programming language's ActiveX functionality to call the Engine's UnloadAllModules method.