Forum Discussion

rajeevsr115's avatar
rajeevsr115
Occasional Contributor
13 years ago

How to stop Current Test Item execution and proceed to the next Test Item.

Hi,



I am Using Test Complete 8.



I will be arranging all my test cases as seperate test Items in Project.



Suppose if an application crash occurs on executing a particular Test Item, I need to terminate my application , restart and proceed to next test item.





Please refer the attachment for more info.

5 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    Two things you need to ensure.



    First, on your test item, set the "stop on error" property to "Test Item".  That will stop that one test and then proceed to the next without killing your whole project.



    Secondly, you will need to create and assign an OnStopTest event handler.  In that handler, you'll want to detect that a failure occurred and then, if there was a failure, reset your environment to your basic starting point.


  • safrrhmn's avatar
    safrrhmn
    Occasional Contributor
    HI,

    Can you provide me some code in regarding to this please? I was trying to restart the same subroutine for some cetain errors
  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi Saifur,


     


    The event handler code will depend on your needs. As a rule, it can look like this:




    //JScript


    function GeneralEvents_OnStopTest(Sender)


    {


      //do something


      Routine ();


    }




     


    Refer to the "Handling Events" article for more information.


     

  • ngoodman's avatar
    ngoodman
    New Contributor
    The OnStopTest event is fired for several different reasons (e.g. Runner.Halt, exception, or the test completed successfully).



    How is it possible to know why the event was raised? At the point you reach the OnStopTest handler, all the script variables have been disposed.
  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi Nicholas,


     


    Project variables are still available in the OnStopTest event handler.