Forum Discussion

kchoudhury's avatar
kchoudhury
Contributor
13 years ago

Question related to OnStopTest and OnStartTest Event

Hi ,



I want to use the OnStopTestEvent to occur after every test item that is executed , by default it does get triggered after every testitem  but it also gets triggered once more at the end of the test run (which i dont want) .



 is there a way i can avoid the event to execute after all the testitems have completed?



Same problem with OnStartTestEvent


  • AlexeyK's avatar
    AlexeyK
    SmartBear Alumni (Retired)

    Kaushik,


    I failed to reproduce the behavior you are speaking about. I created a sample project with test items and the OnStopTest event handler. I run the entire project.


    As far as I can see, the event is triggered when a test item is over, it is not triggered when the entire project test run finishes. So, perhaps, the cause is in your project...


     

  • Alex ,



    Try this create a project , create 3 script routines .



    Add two test items to the project for the 1st and 2nd routine



    Add an onstoptest event handler and point it to 3rd routine



    Now run the project , the 3rd routine will execute at the end of the first testitem

    Then again 3rd routine will execute at the end of the second testitem



    **Now since your project has only 2 testitems so after both of them completes the entire test completes and the onstopevent handler is again called once more .


  • AlexeyK's avatar
    AlexeyK
    SmartBear Alumni (Retired)

    Kaushik,


    I did exactly what you wrote. I attached my project to this message, so you can see for yourself.

    In my case, the OnStopTest event handler is executed two times (after the first test item and after the second test), it is not executed for the 3rd time when the entire project run is over.

  • Alex ,



    You are right , i guess i am doing something wrong in my scripts . Thanks for the help.