NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I get a variable to be stored in the results?

My report option is set to 'exclude passed,done,skipped' in order to only store failed results. How do I then get a local or global variable stored with this failed result ie temperature?
0 Kudos
Message 1 of 7
(3,781 Views)
Steve -
You could add a statement step in the cleanup step group that has a precondition of
"RunState.SequenceFailed"
and the expression for the step is
Step.Result.ReportText = "Locals.Temperature: " + Str(Locals.Temperature)

Scott Richardson (NI)
Scott Richardson
https://testeract.com
0 Kudos
Message 2 of 7
(3,781 Views)
Thanks this is seems ok. The only thing I do not like is that the statement variable gets printed further down the page from the failure. When there are more than one failure and different temperatures it is not clear which failure occurs at which temperature variable.
0 Kudos
Message 3 of 7
(3,781 Views)
Steve,

I'm assuming that you have this particular kind of test that runs to get the temperature measurement and then based upon that measurement the step might pass or fail. If this is the case then you could make a custom step type which has a "temperature" result property. All of the properties under "Step.Result.xxxx" will be included in the report automatically. The benefit of this is that the temperature value will appear in the report under the step name so you will know for sure which step and which temperature correspond.

We have a tutorial online that explains How do I Make a Custom Step Type?.

Hope that helps!

Regards
,
Shannon R
Applications Engineer
National Instruments
0 Kudos
Message 4 of 7
(3,781 Views)
No not quite, I already have a test step that may pass or fail. If this step fails then I also wish to print out another (temperature) variable with it.
I have set the report options to only print failures.
0 Kudos
Message 5 of 7
(3,781 Views)
Steve -
1) There is a sequence option that is off by default called, "Immediately Goto Cleanup on Sequence Failure". If this was on the statement step result would be "closer" to the failure.

2) If you do want to continue after a failure and not goto cleanup, the statement step could be placed after the expected step that will fail. But you would have to add it to places you need the temperature on failure.

3) Depending on the type of step you are using, if the Post Expression is available to be customized, you could set the report text on the step that can fail:
Step.ReportText = ((RunState.SequenceFailed) ? ("Locals.Temperature: " + Str(Locals.Temperature)) : "")

Scott Richardson (NI)
Scott Richardson
https://testeract.com
0 Kudos
Message 6 of 7
(3,781 Views)
Thanks for that, option 3 seems to put the variable closer to the step failure.
0 Kudos
Message 7 of 7
(3,781 Views)