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.
Solved! Go to Solution.
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) : "")
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
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.
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,