QTP中為什麼恢復場景(Recovery Scenario)沒有被觸發?

TIB發表於2010-01-25

Tarun Lalwani在這篇文章歸納總結了5種QTP的恢復場景不會被觸發的情況:
Why is my Recovery Scenario not getting fired?
http://knowledgeinbox.com/articles/qtp/recovery-scenario/why-is-my-recovery-scenario-not-getting-fired/


Debugging Recovery Scenario (RS) is always been a tough ask. But knowing situations where RS won’t work before hand can be of added

advantage. In this article we will explore various possible scenarios where RS is not fired. We will assume the RS to be fired is “Any Error”

 

Situation #1 - Script Errors   指令碼中沒有涉及到測試物件的情況下,RS是不會被觸發的!

Errors NOT involving any Test Object won’t fire any recovery scenario. All the code lines listed below will raise an error but not a RS

X = 2/0
Y = Left("Test", -2)

 

Situation #2 - Object Not in Object Repository (OR)   物件不在OR中這種錯誤也不會觸發RS的執行!

If you try to access a object from the OR and it does not exist in the OR at all, then QTP will throw an error and RS won’t be fired. Object not

found in object repository error is treated as a Script error by QTP and is raised directly.

 

Situation #3 - Modal dialog blocking execution   模式的對話方塊擋住了執行也不會觸發RS的執行!

In case the operation you have performed causes a modal Dialog to appear, RS can’t get fired in such situations. The simplest example of this

the code shown below

Msgbox "You can't fire a Recovery scenario now"

The call to the Msgbox blocks execution in current thread and QTP get busy waiting for someone to close the message box. In such situations

no RS can get executed

 

Situation #4 - Associated Library is not found   找不到關聯的函式庫這種錯誤也不會觸發RS的執行!

In case the RS action is to call a Function from a Library file and Library file is not found, the RS will not get triggered.


Situation #5 - Activate Recovery Scenario setting is not configured properly   如果Active Recovery Scenario被設定為“Never”也不會觸發RS

Go to File->Settings…->Recovery (Tab)->Activate Recovery Scenario option. If the value is set to ‘Never’ no RS can get fired, in case value is

set to ‘On Error’ then the recovery scenario will only be fired when an error occurs. In case the scenario is not fired change this setting to ‘On

Every Step’

相關文章