Setting a Custom Timeline in TestStand to Prevent From Execution

Updated Jan 7, 2025

Environment

Software

  • TestStand

TestStand is a flexible programming architecture that we can define the step, engine callback, code module, and report generation as per requirement. There are times that a user would like to prohibit other users from executing the test sequence in that particular timeline. This is totally possible in TestStand by developing your own code to set the timeline.

In this article, we are going to introduce two methods to set the timeline that we can execute the TestStand code.

  1. Using TestStand API
  2. Using LabVIEW adapter

  1. Using Teststand API
    1. In the TestStand, add a Statement step. In this Statement step, save the current date to a local variable using the expression as below:
      Locals.CurrentDate  = Date()
    2. Add an If condition after the Statement step. In the Conditional Expression, check if the current date saved in the local variable has exceeded the timeline.
      Locals.CurrentDate >= "2024/12/25"
      
      //If current date is greater than or equal to specified date (True) (the date is expired), abort the execution.
      //If current date is not yet greater than or equal to the specified date (False), skip the If statement.
    3. Inside the If condition, use TestStand API to abort the execution as below:
      RunState.Execution.Abort()
    4. Save the sequence. Once the user wants to execute the sequence, it will check for the timeline first; if the current date has exceeded the set timeline, the execution will be aborted.

  2. Using LabVIEW adapter
    1. In the LabVIEW, create a VI as below to check the current date and the set timeline. Remember to connect the terminals of the controls and indicators.
      Terminate if exceed timeline.png 
    2. In the TestStand, create an action step to call the LabVIEW VI of the above.
    3. Set the timestamp as the timeline.
    4. Once the user executes the sequence, an error will throw out to stop the execution.

 

Next Steps

Note that the above two methods are customizable and are not the only solutions that can be used. The methods are applicable when the user run the sequence.

If you need to automatically show the error or prevent the user from executing the sequence file, you may use the engine callback to do so. To use the engine callback, you can add the SequenceFileLoad engine callback at the sequence pane. Then add the methods above into this SequenceFileLoad engine callback. Whenever the sequence file has expired or reached the set timeline, once opened, it will immediately abort or throw an error to disable the user from executing the sequence file.


Also, if you need to set a password-protected for the sequence file, you may refer to the article: Lock TestStand Sequence File from Editing or Viewing.
If you are using the LabVIEW adapter, consider to lock the block diagram of the LabVIEW as mentioned in this article: Locking The Block Diagram in LabVIEW instead of locking the whole sequence file. You could change the timestamp control to a constant so that the user is not able to change the set timeline in the block diagram.