NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Unique ID for each Test Execution from TestUUT level

I'm looking for unique ID for each time when TestUUT is executed. 

 

I could find ID for

  • each test sockets using RunState.TestSocket.MyIndex,
  • each UUT uses its own serial number as ID,
  • each Step Unique ID

But I'm looking for still top-level ID, i.e., ID of each run/execution of the sequence.  Is there any such?

 

Thanks

Ajay.

--
Ajay MV


0 Kudos
Message 1 of 8
(1,732 Views)

How about Execution.Id or Thread.Id?

Michał Bieńkowski
CLA, CTA, CPI

  1. Did someone devote their time to help solve your problem? Appreciate it and give kudos.
  2. Problem solved? Accept as a solution so that others can find it faster in the future.
  3. Contribute to the development of TestStand by voting on the TestStand Idea Exchange.
0 Kudos
Message 2 of 8
(1,717 Views)

I used RunState.Execution.UniqueID and it always gives the same ID how many ever times I run the sequence again.  It changes only after I restart the Teststand.

 

I believe thread ID would also be less helpful, I expect there could be numerous threads that could invoke under a single run.  I will give it a try, do you know where I can find it?  Is it in RunState.xxx.xxx like?

--
Ajay MV


0 Kudos
Message 3 of 8
(1,712 Views)

You can get it in many ways. See diagram: https://zone.ni.com/reference/en-XX/help/370052AA-01/tsapiref/infotopics/teststand_api/

But normally you will get it from Execution (here you also have many options): https://zone.ni.com/reference/en-XX/help/370052AA-01/tsapiref/reftopics/execution/

Michał Bieńkowski
CLA, CTA, CPI

  1. Did someone devote their time to help solve your problem? Appreciate it and give kudos.
  2. Problem solved? Accept as a solution so that others can find it faster in the future.
  3. Contribute to the development of TestStand by voting on the TestStand Idea Exchange.
0 Kudos
Message 4 of 8
(1,703 Views)

@Ajay_MV wrote:

I used RunState.Execution.UniqueID and it always gives the same ID how many ever times I run the sequence again.  It changes only after I restart the Teststand.


I think you meant Execution.Id. Yes, this behavior is expected. But if you want some different ID each time you start execution, combine Execution.SecondsAtStart with Execution.Id: Str(RunState.Execution.Id) + Str(RunState.Execution.SecondsAtStart*10000000)

Michał Bieńkowski
CLA, CTA, CPI

  1. Did someone devote their time to help solve your problem? Appreciate it and give kudos.
  2. Problem solved? Accept as a solution so that others can find it faster in the future.
  3. Contribute to the development of TestStand by voting on the TestStand Idea Exchange.
0 Kudos
Message 5 of 8
(1,701 Views)


I think you meant Execution.Id. Yes, this behavior is expected. But if you want some different ID each time you start execution, combine Execution.SecondsAtStart with Execution.Id: Str(RunState.Execution.Id) + Str(RunState.Execution.SecondsAtStart*10000000)


@bienieck Thanks for feedback Both Execution.Id and SecondsAtStart are not unique between the test sockets as in the screenshots below.   I'm looking for an ID which never changes between test sockets but is unique for each TestUUTs entry point execution.

 

Ajayvignesh_MV_2-1645081494677.png

 

Ajayvignesh_MV_3-1645081545283.png

 

--
Ajay MV


0 Kudos
Message 6 of 8
(1,691 Views)

Can't you use socket execution id? It should be unique. Combine it with timestamp and it's done.

Michał Bieńkowski
CLA, CTA, CPI

  1. Did someone devote their time to help solve your problem? Appreciate it and give kudos.
  2. Problem solved? Accept as a solution so that others can find it faster in the future.
  3. Contribute to the development of TestStand by voting on the TestStand Idea Exchange.
0 Kudos
Message 7 of 8
(1,687 Views)

Or maybe generate GUID using .NET when new socket execution starts and save it as execution runtime variable.

 

https://docs.microsoft.com/pl-pl/dotnet/api/system.guid.newguid

Michał Bieńkowski
CLA, CTA, CPI

  1. Did someone devote their time to help solve your problem? Appreciate it and give kudos.
  2. Problem solved? Accept as a solution so that others can find it faster in the future.
  3. Contribute to the development of TestStand by voting on the TestStand Idea Exchange.
0 Kudos
Message 8 of 8
(1,684 Views)