You can run the entire test project or project suite, or individual automated tests. This topic explains how you can run automated tests from the TestComplete IDE. For other ways to run automated tests, see Running Tests.
Before running tests
You should run automated tests in an environment with proper initial conditions to avoid possible errors due to environment inconsistencies. For example:
-
If a test runs the application, make sure that the application is not already running.
-
If a test works with an already running application, make sure the application is in the right state for the test.
-
If a test creates files, make sure these files do not already exist.
-
And so on.
If needed, add the appropriate commands at the beginning of the test to create proper initial conditions.
Run tests
Run the entire project or project suite
Run tests by tags and tag expressions
Run a runnable project item (a low-level procedure, unit test and so on)
Run the entire project or project suite
-
Configure the test run order on the Test Items page of your project.
-
If needed, configure the project run order on the Test Items page of your project suite.
-
Select Run Project or Run Project Suite from the Test menu.
– or –
Select Run > Run Project or Run > Run Project Suite from the Test Engine toolbar.
Notes:
-
If a project does not have project items, the test engine is unable to run it and shows the The project_name project cannot be run because there are no test items in it message. You can add test items to the project or select a test to run.
-
If the project suite does not contain projects or if all of the projects are excluded from the suite run, the test engine is unable to run the project suite and shows the The project suite cannot be run because there are no selected projects to be run message.
Run a keyword test
-
Right-click the needed script unit in the Project Explorer and select Run from the context menu.
– or –
-
Open the test in the Keyword Test editor and then click Run Test on the editor’s toolbar.
Run a script routine
-
Right-click the needed script unit in the Project Explorer and select Run | Run RoutineName from the context menu.
– or –
-
In the Code Editor, place an insertion point inside the routine code and then click Run This Routine on the Code Editor’s toolbar.
Note: | This works only for script routines that have no parameters. Routines with parameters can be called only from other tests, because you need to specify parameter values. |
Run tests by tags and tag expressions
Run a runnable project item (a low-level procedure, unit test and so on)
-
Right-click the item in the Project Explorer and select Run from the context menu.
Run a test that was launched last
-
Select Run > Repeat Last Run on the Test Engine toolbar.
Pause test runs
To pause a running automated test, do one of the following:
-
Click the button on the TestComplete indicator.
-
Press Shift+F10 (the shortcut can be changed in the Global Shortcuts dialog).
-
Click Pause on the Debug toolbar.
Note: | You cannot pause network suites (distributed tests) and low-level procedures. |
When a test is paused you can:
-
Debug the test: step through it, view variable values and so on.
-
View the current test log (if the Show Log on pause option is enabled).
Resume test run
To resume a paused test, do any of the following:
-
Click the button on the TestComplete indicator.
-
Press Shift+F3 (the shortcut can be changed in the Global Shortcuts dialog).
-
Click Run on the Test Engine toolbar.
-
(For keyword tests only) Right-click within the Keyword Test editor and choose Continue from the context menu.
Stop a test
To stop the test before it completes, do any of the following:
-
Click the button on the TestComplete indicator.
-
Press Shift+F2 (the shortcut can be changed in the in the Global Shortcuts dialog).
-
Click Stop on the Test Engine toolbar.
TestComplete lets you stop tests on timeout and on errors. For more information, see Controlling Test Execution Flow.
You can also stop the test run from the test itself:
-
in keyword tests - using the Stop Execution operation,
-
in scripts - using the
Runner.Stop
orRunner.Halt
method (the difference is thatStop
does not log an error).
Stop tests on errors and exceptions
By default, if an error occurs during the test run (for example, a tested object is not found), TestComplete posts information about it to the test log and stops the test run. Also, if an unhandled exception occurs in your script test (for example, the list index is out of bounds), TestComplete shows an error message and stops the test run. You can change this behavior to handle errors in the way you need. You can configure TestComplete to do the following:
-
Ignore any errors and continue the test run.
-
Stop the current test and proceed with the next test (applicable, for example, when running a project or when running tests by tags).
-
Stop the test run when an error limit is reached.
-
Stop the test run only when a specific error occurs.
To learn how to do this, see Controlling Test Execution Flow.
Test playback options
You can change the mouse movement and text input speed, default object waiting timeout and other playback options in your TestComplete project properties. For a description of available options, see:
See Also
Running Tests
Running Tests - Specifics
Specifics of Using TestComplete on Various Windows Operating Systems