NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

TestStand API - Get the status of a a step

Hello to everyone,

 

I'm working with the C# API of TestStand, basically what I'm doing is to read values of RunState... and also setting values to RunState...

 

I have a "MainSequence" (I only have access to this TS Context) and I also have a subsequence called "Sequence1", the "Sequence1" is called by the "MainSequence" and I want to access to the different step results of the subsequence "Sequence1".

 

Once the "Sequence1" is executed I get this results: (see the attached image)

 

If I read the string: RunState.SequenceFile.Data.Seq["Sequence1"].Main["Message Popup"].Result.Status --> the string is "" --> I only have access here!

If I read the string: RunState.Sequence.Main["Message Popup"].Result.Status --> the string is "Done"

 

How can I get these results if I only have the context of the MainSequence?

 

Have a good weekend!

Much thanks for your time and dedication!
0 Kudos
Message 1 of 9
(7,774 Views)

Is this for a custom user interface?

 

If so, you should hook up to the UI message "UIMsg_Trace". This is what the execution display already does. It requires the station to be configured to create those trace events though.

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 2 of 9
(7,767 Views)

Hello Norbert,

 

No it's a specific "home made" application.

 

Any other way to get this information through the context of the MainSequence?

 

I think I have found a TestStand bug... isn't it?

Much thanks for your time and dedication!
0 Kudos
Message 3 of 9
(7,764 Views)

You should not meddle with the dataset of the execution unless in specific situation, which are handling callbacks.

 

That being said, i still dont understand WHEN you try to collect that data. Is it during execution of the sequence or after it has finished?

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 4 of 9
(7,758 Views)

During the execution, I want the get the value of:

 

RunState.SequenceFile.Data.Seq["Sequence1"].Main["Message Popup"].Result.Status

 

In different moments...

Much thanks for your time and dedication!
0 Kudos
Message 5 of 9
(7,753 Views)

The lookup string (the string you marked in bold) depends on what context you pass to your code. Additionally, the context changes, so passing the context once and try to access it many steps later will not work out.

 

Without seeing any code, i doubt that there is much more we can do to help you.

Still i urge you to dig into UI Messages and use this recommended way to handle tasks like you are on to.

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 6 of 9
(7,751 Views)

RunState.SequenceFile.Data.Seq["Sequence1"].Main["Message Popup"].Result.Status is the edit time copy of the sequence and is not used or updated at runtime. You don't generally want to be accessing this unless you are wanting to programmatically edit the sequence file.

 

You probably should be using collected results rather than trying to access step result statuses directly. As each step in teststand executes, by default, results are collected and stored in Locals.ResultList. Keep in mind TestStand supports looping and recursion so looking a the current result of a step does not really make sense since there are potentially multiple statuses for that step since it might have run more than once. In the mainsequence's Locals.ResultList there will be data for any subsequences called inside of the results for the sequence call. Set a breakpoint and look at the contents of the variable in the execution document to get an idea of the format of the results.

 

There are many other ways to do things in TestStand, so this is just one of many ways. But if what you are doing is result processing then this is the main approach. Really, the main approach is accessing these results from the process model or a process model plugin. If you provide more details about what you are trying to do then I think someone might be able to give you an approach that is better tailored to your use case.

 

Hope this helps,

-Doug

 

 

0 Kudos
Message 7 of 9
(7,739 Views)

Hi,

 

RunState.Main.Locals.ResultList ... is what you want. RunState.SequenceFile.Data... is not commonly used, I would not use it, I've never even seen it.

 

I can't really tell what you want to do. After subsequence1 executes and the execution returns to Main, you want to look at a result from a step in subsequence1?

 

You might consider just copying this variable you are looking for, up to a Local variable that you can create in your Main Sequence. Why bother manually traversing the whole ResultList. You can do that, but it doesn't seem very simple, readable or maintainable. From subsequence1 you can pass it up through subsequence1 parameters, or write it directly to RunState.Main.Locals.MyString.

 

cc

0 Kudos
Message 8 of 9
(7,703 Views)

Hello to all of you and thanks for your help,

 

I will explain my case as good as I can:

 

I have this structure:

 

Subsequence1:

Step 1 - Test 1 --> I only can check the result of the test in the Result.Status

Step 2 - Test 2 --> I only can check the result of the test in the Result.Status

Step 3 - Test 3 --> I only can check the result of the test in the Result.Status

 

Main Sequence:

Step 1 - I pass the context of the Main Sequence to a DLL. I execute a public function of the DLL, once this function is done I activate a timer and I continue with the Step2. While the timer is ON I want to check every 200 miliseconds the results of the Steps of Subsequence 1.

Step 2 - Call to Subsequence 1

Step 3 - End of the main sequence

 

Hope this explanation helps.

Much thanks for your time and dedication!
0 Kudos
Message 9 of 9
(7,693 Views)