06-18-2021 07:18 AM
Hello,
i created a non-adapter teststep where is set in pre-expression:
Step.Result.Error.Occurred = True,
Step.Result.Numeric = 13,
Step.Result.Error.Code = 123,
Step.Result.Error.Msg = "My custom error"
after this i added a Message popup which shows:
Str(RunState.PreviousStep.Result.Status) +"\r\n" +
Str(RunState.PreviousStep.Result.Error.Occurred) +"\r\n" +
Str(RunState.PreviousStep.Result.Error.Code) +"\r\n" +
Str(RunState.PreviousStep.Result.Error.Msg)
What i now see when executing:
The non-adapter test is marked red as Error and the popup shows:
Error
False
123
My custom error
Question:
Why does it not show Error.Occurred = True in the popup?
Thanks
Solved! Go to Solution.
06-22-2021 06:12 AM - edited 06-22-2021 06:20 AM
Hi, I think it is expected behavior. As soon as the error occurs, Teststand shows you a dialog (basically reporting the error occurred to the user) and step status is set to "Error" and the same gets rerecorded to results/report collection. As soon as the error is reported to the user, the error.occurred flag set back to False. To confirm this, you can breakpoints and monitor step result error boolean values.
If you are curious, create a SequenceFilePostStepRuntimeError callback sequence and add message popup and you can use following expression Str(RunState.Sequence.Parameters.Step.Result.Error.Occurred). This will display "True" as your still in custom error handling part and reporting error to the user.
Refer to this link to know more - https://zone.ni.com/reference/en-XX/help/370052W-01/tsexamples/infotopics/callbacks_sequencefilepost...
06-22-2021 06:22 AM
Yes, with a breakpoint i can see that it is set to true.
But what is the use of this variable if it cannot be used in the testplan and user has to use the variable "Result.Status" to get the status of the previous step?
06-22-2021 06:52 AM
I understand your concern. I believe, it is used as a trigger from the any step to prompt user and reset the trigger to false once done (I think, it's by design). If you are interested about error occurred or not, the best way is to use "xxx.Step.Result.Status" for logging purpose. Status could be "Error, Done, Running, Pass, Failed etc."
If you are really concerned, you could use conditional statement in post expression and update variable. Use this variable in your reporting. I hope this helps.