07-18-2016 04:56 AM - edited 07-18-2016 05:00 AM
How I can copy Step.Result.Error.Code for a particulat step to a Local variable.
I want to print the value of Step.Result.Error.Code in my test report.
Please help. thanks in advance.
Regards,
Sagar Joshi
Solved! Go to Solution.
07-18-2016 05:03 AM
Hi Sagar,
You could copy the error code to the ReportText, using the following post-expression:
Step.Result.ReportText = (Step.Result.Error.Occurred == True ? "Error Code: "+ Str(Step.Result.Error.Code) : "")
Regards,
Charlie
Charlie Rodway | Principal Software Engineer | Certified TestStand Architect (CTA)
Computer Controlled Solutions Ltd | NI Silver Alliance Partner | GDevCon#1 Sponsor
07-18-2016 05:11 AM
Thanks CharlieRodway, But I guess the post expration will not execute if any error occure while executing the step. Right?
I earlier used following expration in post expration. Nut I saw that the Local variable is not updating on Step failure.
Local.StepErrorCode = Step.Result.Erroe.Code
07-18-2016 05:29 AM
Hello CharlieRodway,
I tried your solution but the Post Expration is not executed when the step if failed.
When I am monitoring the Step.Result.Error it has updated the error code. Msg and Occured to True, But the Result.ReportText is not updated.
It means that the Post expration is not executed when the Step is failed.
07-18-2016 05:31 AM
Yes, of course!
This is best handled by the SequenceFilePostStepRuntimeError Callback:
1). Add StepResultCode (Number) to FileGlobals
2). Add SequenceFilePostStepRuntimeError Callback to your sequence file
3). Add the following Statement step to the SequenceFilePostStepRuntimeError Callback:
FileGlobals.StepErrorCode = Parameters.Step.Result.Error.Code
Here's a snapshot of the sequence:
I hope this help,
Charlie Rodway | Principal Software Engineer | Certified TestStand Architect (CTA)
Computer Controlled Solutions Ltd | NI Silver Alliance Partner | GDevCon#1 Sponsor
07-18-2016 05:47 AM
Thanks a lot Charlie Rodway