About Controlling Test Execution Flow

Applies to TestComplete 15.69, last modified on November 13, 2024

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:

Execution Plan editor of a project

Click the image to enlarge it.

You add them to your project in the Execution Plan editor. 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 Execution Plan editor description. When you run your project, it executes its test items in the order they are listed in the Execution Plan editor.

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:

Runtime properties

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.

BDD properties

These properties affect BDD tests only. Use the Stop the entire Scenario Outline if any example fails property to control how to handle errors when running scenario outlines (scenario templates).

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

See Also

Execution Plan Editor
Tests, Test Items, and Test Cases
Running Tests
Stopping Tests on Timeout

Highlight search results