12-13-2018 07:22 AM
Hi,
I have a couple of numeric limit test steps which result recording are disabled by default (when step passes). However, in case of step fail I want to enable step result recording but how to do that? Is it possible to do using SequenceFilePostStepFailure callback and programmatically enable there or how?
In other words, do not record step result if step passes, record if fails.
Br,
Jick
Solved! Go to Solution.
12-13-2018 07:47 AM - edited 12-13-2018 07:48 AM
One way that i have accomplished this before was to enable recording on the step. Once recording on the step is enabled, use a statement step below your numeric test to check the previous steps result by using RunState.PreviousStep.Result.Status == Pass. If the result is true then simply delete the last element out of Locals.ResultList. If it fails leave the entry it in the result list, which will then report it. During runtime, your report will look like it is capturing all the pass data, but once execution finishes and it compiles your report, all the passes should be gone!
I guess you could do something similar in the SequenceFilePostStepFailure by checking Step.Result.Status == Pass. However you will need delete the entry in Locals.ResultList entry from your caller and not in Post Step Failure Callback which could be a little bit trickier.
12-13-2018 10:13 AM - edited 12-13-2018 10:13 AM
Attached is another example of how to accomplish this. Using the SequenceFilePostResultListEntry you can discard results based on status. In my example you will see that I check the step status for Passed. If it it is Passed then I discard the result from ever getting put in the ResultList.
Cheers,
12-14-2018 01:42 AM
Thanks!
I will check these out. ~jiggawax~, could you save your example for TS version 2016, thanks!
Br,
Jick
12-14-2018 06:29 AM
I am also struggling with the alright_meow's method. How do I remove the latest element from the ResultList? Attached an example of what I tried but it throws an error (Error in argument 2, '"[GetNumElements(Locals.ResultList)-1]"', in call to the expression function 'RemoveElements'.).
Br,
Jick
12-14-2018 10:56 AM
Would result filtering not work for this?
-Trent
12-17-2018 12:30 AM
I need this only for the specific steps and sequences but this is good to know, thanks.
I solved my problem using statement step after the step which needs result record skipping:
SetNumElements(Locals.ResultList,GetNumElements(Locals.ResultList)-1)
with precondition RunState.PreviousStep.Result.Status == "Passed"
Br,
Jick