Programmatically Disable Test Sockets in the Batch Process Model

Updated Nov 3, 2020

This knowledge base article explains how to disable specific test sockets at the beginning of your test sequence running with the Batch Process Model. Following the steps in this article will allow you to conditionally disable test sockets to save time when running your test sequence.

Please note that the default behavior of the Batch Process Model in Teststand is to display a dialog window prior to executing a test sequence that allows you to disable individual test sockets by simply checking a box. However, if you are using a custom dialog window or if there are different conditions that will determine whether a test socket should be disabled, this article is for you.

  1. Create a new Batch Process Model file so that you can customize the Process Model.
  2. Open the Batch Process Model sequence file by double clicking the model name at the bottom of the Teststand Window.
  3. Select "PreBatch" in the "Sequences" pane.
  4. Right click in the "Steps" pane >> Insert Step >> Statement.
  5. Select the new statement step with a left-click.
  6. Open the "Expression" tab in the "Step Settings" pane.
  7. Add a Teststand expression to the "Expression" field to set the disabled state for a specific test socket.
    • The expression to use is: Parameters.ModelData.TestSockets[SOCK#].Disabled = [boolean expression]
    • SOCK# represents the specific socket you wish to set the disabled state for.
    • The boolean expression will determine whether the socket is disabled. If the boolean expression is evaluated as "True", then the test socket will be disabled. If the boolean expression evaluates as "False" the test socket will be enabled.