While you are still developing and debugging your tests, you can run them directly from TestComplete IDE. However, after your tests are ready for unattended (automated) runs, it could be convenient to specify a sequence of tests and run them in a batch. You can do it by using test items:
You add them to your project on the Test Items page. For each test item, you specify the test it will run (it can be a script routine, a keyword test, a unit test, a Selenium test, a ReadyAPI test - basically any TestComplete test), the number of iterations, its parameters (if needed), and so on. To learn more, see the Test Items page description. When you run your project, it executes its test items in the order they are listed on the Test Items page.
During unattended runs, you may want to control your project behavior on various unexpected events, for example, on errors or warnings: ignore the events and continue running the tests, stop the problematic test and move to the next one, stop the entire test run, stop the test run when a specific event occurs, stop the test run when an error limit is reached, and so on. There are several ways to control your project behavior on such events.
Project Properties
Projects have a number of properties that control their behavior during the test run. You can find them on the Properties > Runtime page of your project, in the Error handling section:
You use the On error, On warning, and On object recognition error properties to configure your project behavior if an appropriate unexpected event occurs during the run. You can command the project to:
-
Ignore the event.
-
Stop the current test and proceed with the next test (if it is applicable).
-
Stop the entire test run.
-
Stop the current test and rerun it (via the On error property).
These properties affect standalone tests you run (for example, tests you run from the Project Explorer). The On error property also affects project test items and tests run by tags unless specified otherwise (see below).
The Rerun failed test items property specifies the number of retries for failed tests. This property will be applied if either the project On error property or a similar individual test item property (see below) is set to Stop and rerun current item.
In addition, you use the Show notification message box on unhandled script exceptions property to specify whether you want TestComplete to show an error dialog if an unhandled exception occurs in your script test. If the property is enabled and an exception occurs in your script test, TestComplete will show a message informing you about the problem.
We recommend that you disable this property when you run tests as test items. If an exception occurs during the test run, TestComplete will not show any messages and will act according to the On exception property of your test items (see below).
Note: This property affects only script engine exceptions, for instance, the “List index is out of bounds” exception. It does not affect TestComplete test engine errors, like object recognition errors or errors posted to the test log by the Log.Error
method.
Test Item Properties
For each test item you add to your project, you can use the On error and On exception properties to specify the project behavior if an error or exception occurs during the test item run: to ignore it and continue running the item, stop the item and proceed with the next item, or stop the project run completely.
The On error property you set for individual test items overrides the Error handling > On error property of your project.
The On exception property is only effective when the Error handling > Show a notification when an unhandled script exception occurs property is disabled in your project.
Note: This property affects only script engine exceptions, for instance, the “List index is out of bounds” exception. It does not affect TestComplete test engine errors, like object recognition errors or errors posted to the test log by the Log.Error
method.
Common Scenarios
Use the combination of project properties and test item properties to configure your project behavior in the way you need. In the topics below, you can find the most common scenarios of handling errors and exceptions:
Stop the Current Test Item Right After an Error and Proceed With the Next Test Item
Stop a Project Run on an Error
Stop and Rerun the Current Test Item After an Error
Stop Current Test Item on the N-th Error
Stop Project Run on the N-th Error
Stop Current Test Item Only on Specific Errors
See Also
Test Items Page (Project Editor)
Tests, Test Items, and Test Cases
Running, Rerunning, Pausing, and Stopping Automated Tests
Stopping Tests on Timeout