Advisor
ExitActionIteration doesnot work if "On Error resume Next" is used.
[ Edited ]

Hi, 

 

Today i experienced that "ExitActionIteration" does not work in the function when "On Error resume Next" is used.

 

(This only happens when functions are kept in a library files. If function is written in the calling action then 'ExitActionIteration' is working fine).  

 

We are usually keep our functions in library files, where in some conditions we need to exit the ActionIterations, but in this case we are unable to do that and our tests keep running even in failure scenarios.

 

 

Currently i am using UFT11.52, but i believe that this issue should persists in previous versions of QTP also.

 

 

 Please tell if this is an expected behaviour? If yes then please let us know how can we exit the iteration from a function where "On error Resume next" is used (and the function is written in external/library file) ?

 

 

Note: I could find the solution where i am using "ON error goto 0" before "ExitActionIteation" , and whoa it worked :-) .

Is there any second thought on this?

 

SampleCode:
Call FuncA   'Keep this code in the  calling Actions

 

'Following Functions should be kept in a library files.
Function funcA
    print "FUNC A CALLED"
    Call Funcb
End Function

Function funcB

    On Error Resume Next
    print "FUNC B CALLED"

     'On Error goto 0

    ExitActionIteration
    Call FuncC

    On Error goto 0
End Function

Function funcC
    print "FUNC C CALLED"    
End Function