Forum Discussion
Hi,
You can use Runner.Stop(true) in-order to stop the current test item execution.
In a basic way, You can add this code into your OnLogError, then it will stop the current test item.
Reference:
- For adding event handler - https://support.smartbear.com/testcomplete/docs/testing-with/advanced/handling-events/creating-handlers/for-testcomplete-events.html
- Using Runner method - http://support.smartbear.com/testcomplete/docs/reference/project-objects/items/script/runner/stop.html
- Related topics that might help you
Here what I have done
The first screenshot shows that event handler get created.
The second screenshot that the functions associated with the events get created .
My main concern is that - should we need to create the functions in other scripts also under the same projects .I mean just copy those functions to other scripts as well.
Please update
Thanks
NG
- AlexKaras7 years agoChampion Level 3
Hi,
Project event is global for the whole project and only one handler's routine is required. It is irrelevant what script unit contains this routine.
- nisgupta7 years agoValued Contributor
SO my question is if the project contain multiple scripts how can I create event handler for multiple scripts ? When we create event control then it asked select any one from the list as shown in the attached screenshot.
If I select any one script and add there then event handler will work for that script only. How can I make ti work for multiple scripts ?
Thanks
NG
- tristaanogre7 years agoEsteemed Contributor
I'm not sure, but I think you're misunderstanding what the event handler script selection does. Basically, what it does is indicate what script should execute when the event happens, not what scripts the event applies to.
So, basically, it goes like this:
1) You write a script that, whenever, for example, you log an error, you want to write something to an SQL database
2) You go to the OnLogError event handler
3) You select the script from step 1
Now, everytime you log an error, that script will execute. It doesn't matter what other script you're running, that event will always write to the SQL database.
Related Content
Recent Discussions
- 2 hours agoSubhraDas
- 21 hours agotramuntana