Unique Thread Identifier in TestStand

Updated Jan 6, 2020

Reported In

Software

  • TestStand

Issue Details

I am using a multithreaded TestStand sequence and need a way to identify the multiple threads.  What identifier should I use? 

Solution

Built into TestStand there is variable Runstate.ThisContext.Thread.UniqueID which will give a unique thread identifier for each thread running within TestStand.  This method is preferred specially on machines where you have multiple instances of the TestStand Engine.

Additional Information

You can also use RunState.TestSockets.MyIndex assuming that there is a single execution and not multiple TestStand instances.