About Controlling Test Execution Flow

Applies to TestComplete 14.0, last modified on January 23, 2019

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:

Test Items page of a project

Click the image to enlarge it.

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:

Runtime properties of a project

Click the image to enlarge it.

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.

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 unless specified otherwise (see below).

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.

Test item properties

Click the image to enlarge it.

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:

See Also

Test Items Page (Project Editor)
Tests and Test Items
Running, Pausing and Stopping Automated Tests
Stopping Tests on Timeout

Highlight search results