Hi , ON ERROR RESUME NEXT will be used to handle expected errors(exception handling). You have to identify what part of your code may give error and put it that in ON ERROR RESUME NEXT block, if err.number > 0 then there is some error. Keep ON ERROR GOTO 0 at the end disable error handling.
Regards, Suman Ch On Tue, Apr 24, 2012 at 9:10 PM, Anish Pillai <[email protected]>wrote: > Hi Kris, > > The basic requirement when you run a set of test cases in batch is that*the > execution should not halt in between > *. Even if a test case fails due to any reason, the framework should have > the ability to leave that test case there and run the next one. > > The main reason why our scripts get struck in between is due to some > unexpected popup. These can be suppressed using On Error Resume Next. ie. > when such an unxpected run time error occurs, On Error Resume Next > instructs QTP to move to the next line. You can have some sort of handle > that catches this exception. > > One way to do this is to have the handler code at the end of every > function you create. > > Eg - > > * > fnDivide() > > Function fnDivide() > > On Error Resume Next > i = 10/0 'exception that throws a popup message is suppressed due to use > of on error resume next > > 'some more code > 'some more code > 'some more code > 'some more code > > 'Handle the exception > If Err.Number <> 0 Then > Reporter.ReportEvent micFail, "Message" , "Message" > 'more handler code... > ' better would be to create a recovery function and call it here > End If > > End Function* > > > * > Cheers, > a n i s h > > [QTP > Tutorial]<http://www.automationrepository.com/tutorials-for-qtp-beginners/>| > [VBScript > Tutorial]<http://www.automationrepository.com/category/qtp-and-vbscript-tutorials/>| > [QTP > Blogs] <http://www.automationrepository.com/qtp-blogs/> > > ** > [** Subscribe to Get New Posts in your Inbox > **]<http://feedburner.google.com/fb/a/mailverify?uri=automationrepository/feeds> > * > -- > ar > > -- > You received this message because you are subscribed to the Google > "QTP - HP Quick Test Professional - Automated Software Testing" > group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/MercuryQTP?hl=en > -- You received this message because you are subscribed to the Google "QTP - HP Quick Test Professional - Automated Software Testing" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/MercuryQTP?hl=en
