I am noticing that ExistActionIteration does not work when On Error Resume Next is turned on. Is this the expected behavior?
On Error Resume Next
Error happens here.
ExitActionIteration <-- QTP does not leave the function.
On Error GoTo 0
ExitActionIteration <--now it leaves the function library and goes to the next iteration of the action.
This is a function in a function library, right? Use 'Exit Function' to exit a function. I'm not familiar with 'ExitActionIteration' (and don't have access to the help files at this moment), but I bet it only works when placed directly inside an Action in a test script.
I believe that what is really happening is
- your error happens at the designated line.
- because of the On Error Resume next, process continues to the first ExitActionIteration.
- this does nothing because "ExitActionIteration" is not be called within an Action/Iteration, or it causes another error that is ignored because of the On Error Resume Next command
- process continues to the On Error Goto 0
- The second ExitActionIteration does nothing
- The function exits because it hits the End Function statement.
This code is in a function in a function library.
On Error Resume Next makes ExitActionIteration not respond. The code continues to the next line in the function. It is telling QTP to ignore the ExitActionIteration command and ignores it.
After the On Error GoTo 0 the ExitAcionIteration command starts working again. The code goes to the first line of the calling action.