Forum Discussion

romanK's avatar
14 years ago

How to stop only test item on Object not found error.

Hi,



I am trying to test web based app.  In a Proect Suite there are two Project each with a few Test Items (script/keyword tests).

I need to run these tests so that if an error ocures in any TestItem only this Test Item  will stop. 



Now there is an error where one of the tests is not able to fined object. after a while it skips this test but contionue running.



Stop on error properties of each Test Item is set to "Test Item".



If I set Project to stop on error it will stop whole project. If I uncheck these properties the Test Item will not stop.





Thanks, 

Roman.

1 Reply

  • irina_lukina's avatar
    irina_lukina
    Super Contributor

    Hi Roman,


    If I uncheck these properties the Test Item will not stop.


    The situation is correct:

    "Right after the execution of the test item has finished, the test engine searches for the error message in the test log formed during the test item's execution. If the log contains errors, the test engine performs one of the following actions: None, Stop Project, Stop Test Item"

    (a quote from the [url= http://smartbear.com/support/viewarticle/11001/]Test Items Page (Project Editor)[/url] help topic).


    So, TestComplete processes errors only after the test item's execution is finished.


    If you need to stop only the test item that posted an error right after this one, I recommend that you follow the steps below:

    1. Add the StopOnError event to the event controls (for more information, see the Adding Events to Event Controls help topic).

    2. Add the following code to the project:



    function GeneralEvents_OnLogError(Sender, LogParams)

    {

     Runner.Stop(true)

    }


    Does this help?