How can I get the run result status according to the current report node?
Asked Answered
W

3

6

For example, suppose a test calls two actions, A and B. A performs a "failed" step by calling "Reporter.ReportEvent micFail, ...", and B performs a "passed" step by calling "Reporter.ReportEvent micpass, ..."

Reporter.RunStatus returns micFail as soon as the failed step has been performed in A. So even in B, with B´s status being completely "green", there is no way to tell that in the "B" branch, there is no "failed" step present. The test run status reported by Reporter.RunStatus" is micFail from then on.

So how can I get the current "branch"´s run status?

I think what I am looking for is the color (i.e. the run status) of the current, or current parent´s, Reporter node.

Womanizer answered 10/9, 2013 at 16:2 Comment(1)
I firmly believe there is a way to get this status. So I´ll keep this question open...Womanizer
R
1

I dont think you can since Run Status is for the complete test and not for individual action. Alternatively, you can call the ExitAction method and store the output in a variable to check the Action Run Status when called from RunAction method.

Rollo answered 12/9, 2013 at 2:9 Comment(2)
Thanks. But this is no answer :) they question is not "if", but "how" :-) and the problem with maintaining a result manually is that I miss playback errors that occur during standard test object playback (among others). For example, if I set OnError to "skip to next statement", I don´t have a chance to update my per-action status accordingly, so I´d report "pass", but the run result says "failed" for this action call branch.Womanizer
Even though this answer simply says "there is no way", I'll now accept this one, and leave it this way until as I have heard of a better conclusion.Womanizer
F
1

If you want to update the per Action Status at run time...

'append "Err.clear" at the start of the action and

if Err.Number<>0 Then
'update your action status to Failed'
End if

at the end of the action. This will occur provided you don't clear the Err.number manually

What it does is if any run time error occurs Err.number gets changed and you can use this to get any run time errors at run time itself. Hope this helps :)

Froemming answered 21/10, 2013 at 6:43 Comment(1)
Unfortunately, this works only if your action does not call any user functions (or subs) since each subroutine call resets the "on error" setting. Also, I´d have to execute "on error resume next" first for Err.Number to carry any runtime error code at all. Finally, I do not see inhowfar all this would deliver the current run result status? Remember, I am looking for the pass/fail/... status that would be displayed for the current step´s parent node in the run result viewer. That one is the "redest" status as inherited from all child nodes.Womanizer
G
1

You can create different nodes for different actions. Every node will show the status of underlying steps (e.g. if any of the steps under that node is failed then node is failed)

Reference for creating nodes in Report: http://www.advancedqtp.com/report-hierarchical-events-in-qtp-log/

You can start a new node for every action, and reset the node as soon as the action is complete.

Gilpin answered 7/10, 2016 at 1:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.