Functional Testing With TestComplete

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

To make sure that an application works properly, you can perform functional testing. This topic explains how you can perform functional testing with TestComplete.

The general approach to functional testing in TestComplete does not differ from that used for other types of testing, and it includes the following steps:

Creating a Test

You can create functional tests as any other tests in TestComplete. Tests can be either created manually or recorded. The easiest way is to record tests. This way does not require that you know an application’s internal objects, you simply start the recording and simulate user actions over the application’s windows and menus. You can click, double-click or drag text, tree nodes and controls inside the application under test, minimize and maximize windows, focus controls, and so on. TestComplete will record a sequence of these actions to a test, which can be modified later. After the test is recorded, you can change values of operation parameters, add new operations to the test, and so on. For more information about recording tests, see Recording in TestComplete - Overview.

To simulate various user actions over windows and controls of the tested application, TestComplete provides a wide range of program objects. It recognizes control types and automatically adds specific methods and properties to the program objects that correspond to these controls. Using specific actions of program objects, you can simulate clicks and keystrokes in the needed window, and so on. See Simulating User Actions.

You can record user actions in the form of scripts, keyword tests or low-level procedures. Low-level procedures are usually used when you need to simulate low-level events such as pressing and releasing mouse buttons, keystrokes and mouse wheel motions. Using scripts, you can create more flexible tests. You can simulate not only keystrokes and pressing buttons, but also call methods and properties of the application’s internal objects. Keyword tests are not so powerful as scripts, but they are easier to create. A keyword test is a sequence of operations (keywords) that simulate user actions over the tested application. Using keyword tests, you can perform various actions over controls and objects and also work with objects that exist within application windows and controls.

In tests, you can both simulate user actions over applications and call methods and properties of program objects and perform verifications of different kinds. With TestComplete, you can check test results by using comparison commands (checkpoints). You can create checkpoints during the test recording as well as at design time. TestComplete allows you to create checkpoints to compare images, files, object text and properties, database tables, etc. For more information about this, see About Checkpoints.

Running a Test

You can run a functional test as a test item or from other tests (keyword tests or scripts). To run an individual test, right-click the corresponding KeywordTest item or the unit holding the needed script routine in the Project Explorer panel and select Run from the context menu. You can also start the test provided by the project or project suite. To do this, click Run Project or Run Project Suite. TestComplete will run the test and will stop the execution when the entire test has been completed. You can also stop or pause the test execution at any time. During the pause, you can change variable values, explore the test log or check the test’s output, its variables and objects by using the TestComplete Watch List or Locals panel or the Evaluate dialog. For more information on running and executing tests in TestComplete, see Running Tests.

While running tests, various events can occur. With TestComplete, you can create routines that handle events. This way, you can avoid unexpected situations when playing back a test or perform specific actions when any event occurs. Note that you can handle not only TestComplete events, but also events that occur in other applications. For example, you can handle exceptions that occur in the application under test or unexpected windows that appear when a test performs an action. For more information about this, see Handling Events With TestComplete.

Analyzing Test Results

After the test is over, we can analyze the automated test results displayed in the Test Log. TestComplete generates a complete log containing all of the actions the tool performs during the test run. It posts messages about results of each test operation, including successful or failed comparison results, to the test log. You can filter log messages by their type or by the information they contain. Also, you can view the test operation that posted a message to the log. See Test Log for more information.

See Also

About Functional Testing
Different Ways of Testing
Simulating User Actions
Running Tests
Test Log

Highlight search results