NI TestStand

Showing results for 
Search instead for 
Did you mean: 

Thread execution number?


Hi - All my test steps use the .Net step types. Is there a way to pass back to (or read from) my C# code the current TestStand thread number that has called my C# code?


When my C# code creates its own log files, it would be helpful to append the TestStand thread number that has generated the C# log file entry to aid sorting and following test execution in a multi-threaded TS sequence.


The current C# log file works well in a single threaded TS sequence but as soon as you add more threads then obviously the C# log file entries are not in an easy to read execution order since they are generated by the multiple threads running.


Thanks in advance,




thanks in advance

0 Kudos
Message 1 of 4

Hello Chris,


You have two methods of doing this:

1. Pass the Sequence Context Reference to your test steps. In your teststep you can use the reference to extract the Thread Reference and later the UniqueThreaID.


2. You can pass directly the ThreadID to your TestStep by passing the RunState.Thread.UniqueThreadId as input to your teststep.


Hope it helps,

Just a TSUser


0 Kudos
Message 2 of 4

Many thanks for your suggestion.





0 Kudos
Message 3 of 4

You are welcome!

If you have validated the solution, please don't forget to mark as solution to this forum thread so that it can be considered as closed !



Just a TSUser

0 Kudos
Message 4 of 4