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

时光毁灭记忆、已成空白 提交于 2019-12-01 02:09:40

问题


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.


回答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.




回答2:


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 :)




回答3:


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.



来源:https://stackoverflow.com/questions/18723774/how-can-i-get-the-run-result-status-according-to-the-current-report-node

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!