Forum Discussion

hokrani's avatar
hokrani
Contributor
14 years ago

TC Stop running if Region Check point fail


1.    Dim ValidCheckPoint

2.    On
Error Resume Next 

3.    ValidCheckPoint=



 



Regions.SummarySection_PrintDoc.Check(objExpected.Picture(97, 369, 410, 80, False))

4.    If Err.Number <> 0 Then

5.         Msgbox "An exception occurred !!! "

6.    End If

7.    Msgbox "TC running next step"

8.    Sub GeneralEvents_OnStopTest(Sender)

9.        Msgbox "TC going to stop"

10.   End Sub





In the above code, I use the region check point.(Line 3)

If the error thrown it @line 3, then i handle it @Line 2 i.e. it should run line 5 and continue running the Line 7 too.



But in the above code it will @Line 9.

Please let me know how to handle such kind of error i.e. i want TC to continue run instead of stop.

 


5 Replies


  • Hi Hoks,





    'On Error Resume Next' handles only the VBScript engine exceptions, not errors that occur during a call to a method of a program object of TestComplete as it is in your case. To avoid posting the error, use the Compare method instead of Check. The Compare method lets you specify the type of the message posted to the test log (warning by default):







      Call Regions.Compare("SummarySection_PrintDoc",objExpected.Picture(97, 369, 410, 80, False))

  • Still getting same problem.



        Dim IsGraphValid

        Set objTargetLynx = Aliases.TargetLynx 

       .MDIClient.wndChromatogram.AfxFrameOrView42.AfxWnd42


          ' TC will stop while running the below code

           IsGraphValid= Regions.Compare("SummationInTarLynx_Type1",objGraph) 

            Msgbox IsGraphValid

         

        OR

         ' TC will return either True or false while running the below code 

        
     Msgbox Regions.Compare("SummationInTarLynx_Type1",objGraph)



    Let me know what is problem in the  above code.

  • Hi,



    Exactly what error message do you get and on which line it occurs?
  • while running the below code, TC will stop it. 



     IsGraphValid= Regions.Compare("SummationInTarLynx_Type1",objGraph) 





    It will not display any error message.

  • Hi,





    To help us investigate the behavior, please zip the entire project suite folder along with the logs of the test execution and send us the archive.