Common Tasks for Keyword Test Operations

Applies to TestComplete 15.47, last modified on January 20, 2023

TestComplete provides keyword test operations for various testing tasks. This topic explains which operations you can use.

Task Operation

To post a message, error or warning to the test log...

Use the Log Message operation of the Logging category.

To post an image to the test log...

Use the Post Screenshot operation of the Logging category. For detailed information on how to work with images from keyword tests, see Working With Images.

To start one or more tested applications...

Use the Run TestedApp operation of the Test Actions category.

To close an application...

Use the Process Action operation of the Test Actions category to call the Close or Terminate method on the application’s process.

To check whether an object exists...

Use the If Object operation of the Test Actions category. For detailed information on how to check conditional statements from keyword tests, see Checking Conditions.

To check the state of an object...

Use the If Object operation of the Test Actions category or the Property Checkpoint operation of the Checkpoints category. For detailed information on how to check conditional statements from keyword tests, see Checking Conditions.

To find an object...

Use the Find Object operation of the Test Actions category.

To simulate a mouse click ...

Use the On-Screen Action or Call Object Method operation of the Test Actions category to call the Click, ClickR, ClickM, DblClick, DblClickR or DblClickM method of the needed window or control. For detailed information on how to simulate mouse clicks from keyword tests, see Simulating Mouse Wheel Rotation.

To simulate a touch action in a mobile application…

Use the Device Touch operation or the Image Touch operation of the Mobile category or the Image Based Action operation of the Test Actions category to simulate touch actions on a mobile device in image-based tests.

Use the On-Screen Action or Call Object Method operation of the Test Actions category to call the Touch, LongTouch or specific methods of the needed object in an Open mobile application.

For detailed information, see:

Simulating Basic Touch Actions Over Android Devices (Legacy)

Simulating Basic Touch Actions Over Android Open Applications (Legacy)

Image-Based Testing

To enter text in a desktop or web application...

In scripts, call the SetText or Keys method of the object you want to enter text in.

In keyword tests, you can call these methods by using the On-Screen Action or Call Object Method operation of the Test Actions category.

For details, see Simulating Keystrokes.

To enter text in a mobile application...

In keyword tests, use the Device Keys operation.

In scripts, use the Keys or SetText action applied to the device or specific mobile object.

For details, see:

Simulating Text Input on Android Devices (Legacy)

Simulating Text Input in Android Open Applications (Legacy)

To simulate user actions over controls...

TestComplete recognizes control types (list boxes, radio buttons, check boxes, combo boxes, edit fields and many others) and automatically adds specific methods and properties to the scripting objects that correspond to these controls. To simulate user actions over controls, call these methods and properties by using the On-Screen Action or Call Object Method operation of the Test Actions category. For detailed information on how to simulate user actions from keyword tests, see Simulating User Actions.

To simulate the selection of a main menu item...

Use the Menu Action operation of the Test Actions category. This operation supports both standard Win32 main menus and menus created with third-party components that are recognized by TestComplete. For detailed information on how to select menu items from keyword tests, see Simulating Menu Actions.

To select an item of a context menu...

Use a combination of the On-Screen Action and Menu Action operations of the Test Actions category. The On-Screen action operation is needed to simulate an action that shows the context menu for a window or control, such as a right-click or an Application key press. The subsequent Menu Action operation allows you to perform the needed context menu operation. This operation supports both standard Win32 context menus and menus created with third-party components that are recognized by TestComplete. For detailed information on how to select menu items from keyword tests, see Simulating Menu Actions.

To call a method or property of an Open Application’s object...

TestComplete provides scripting access to internal objects, methods and properties of tested applications (see Open Applications). To call these methods and properties, you can use the On-Screen Action operation, if the needed object is a window or control, or the Call Object Method operation, if the needed object is invisible. Both operations belong to the Test Actions category. To call methods of invisible objects, you can also use the On-Screen Action operation and change the object the operation works with. See Calling Methods and Properties of Internal Objects. For detailed information on how to work with object methods and properties from keyword tests, see:

Calling Object Methods

Getting and Setting Object Property Values

To run script code...

To run one line of code (for example, a method call or a single statement), use the Run Code Snippet operation of the Test Actions category.

To run a script routine, use the Run Script Routine operation of the Test Actions category.

To run other tests...

Use the following operations:

All these operations belong to the Test Actions category.

To get access to the data storage records or create a data loop...

Use the Data-Driven Loop operation of the Data Access category. It allows you to run a set of keyword test operations for each record of the data storage that is presented in one of the following types:

  • Excel worksheet
  • CSV file
  • Database table

Using this operation you can also create a data loop and run a set of keyword test operations within this loop.

To perform verification actions...

Use operations of the Checkpoints category. They allow you to compare files and images, verify the contents of web pages and XML files, check the web service’s response, check data stored in database tables, check whether the mobile device's screen shows the expected image and perform other tasks.

To delay the test run...

Use the Delay operation of the Miscellaneous category.

To set or restore text of the TestComplete indicator...

Use the Push Indicator Text and Pop Indicator Text operations of the Miscellaneous category.

To handle structured exceptions in keyword tests...

Use the Try, Catch and Finally operations.

  • The Try operation groups operations that may cause an error.

  • The Catch operation contains operations that will be executed if an error occurs in the Try block.

  • The Finally block contains operations that will be executed regardless of whether an error occurs in the Try block.

See Also

Keyword Tests
Keyword Tests
Operation Reference
Setting and Checking a Keyword Test Result
Testing Android Applications (Legacy)
Simulating User Actions Over Android Devices (Legacy)
Simulating Basic User Actions in Image-Based Tests
Simulating User Actions Over Android Open Applications (Legacy)

Highlight search results