Reputation:
Can you please clarify the folowing query? I am not sure if the way I am trying to code is correct. Kindly advise me if I am moving in the right/wrong direction.
I am trying to develop an automation framework using QuickTest Professional, a testing tool.
Upvotes: 1
Views: 889
Reputation: 28762
It's hard to answer your question based on what you wrote, but the first thing that comes to my mind is to add a boolean parameter to your exception-handling function (let's call it ExceptionHandler). Say, if the parameter (let's call it ExitLoop) is true, you wll exit from the "entire loop", otherwise, continue. Now, it might be too tedius to change that for old calls to the function (calls without the new parameter) -- I'm not sure if VB supports function overloading. If this is the case, you can rename your ExceptionHandler to ExceptionHandler2, add the new parameter (ExitLoop) and logic to it and create a (now new) function ExceptionHandler that calls ExceptionHandler2 with its parameters plus true for ExitLoop.
Hope it helps.
Upvotes: 0
Reputation: 28857
Well, it sounds like you already have the answer.. You just need to handle the expection that occurs when reading in the data within the main loop and make it stop there..
Now, I have not done VBScript for a LONG time so, to pseudo it:
While Not EndOfExcelSheet
ReadDataFromExcel();
If errOccurred Then TakeScreenPrint();
'NOTE: We have caught the error and requested the screen print
'is taken, but we have NOT bubbled the exception up!
End While
Upvotes: 1