Errors that occur during the test run can be caused by accidental reasons. Such errors can occur a few times during the project run, and you may want not to stop the test because of them. However, if a number of errors exceeds some limit, it will mean that something goes wrong, and the current project must be stopped.
To configure your project to stop when an error limit is reached:
-
Open the Variables page of your project and create an integer variable. Let’s call this variable ErrorCounter. It will store the number of errors occurred during the project run.
-
If your project does not have the Events collection, add it:
Add an event control to the Events collection and create a handler for the OnLogError event:
-
Configure the event handler to increase the project variable value and to stop the test run when the limit is reached:
-
If you use scripts
Insert the following code into the event handling routine:
-
If you use keyword tests
-
-
Open the Test Items page of your project and set the On error property of all your test items to Continue running. Otherwise, the test run will be stopped on the first error.
See Also
Controlling Test Execution Flow
About Controlling Test Execution Flow
OnLogError Event
Runner.Stop Method
Stop Execution Operation