Calling Object Methods

Applies to TestComplete 15.63, last modified on April 23, 2024

TestComplete provides extended support for a number of controls of popular vendors. To simplify interacting with controls, it provides a number of specific program objects. These objects contain a set of properties and methods specific to onscreen objects, a set of properties and methods specific to a certain type of controls, and (optionally) a number of platform-specific properties and methods (for instance, .NET-based or Qt-based). For more information on associating controls and program objects, see Object Mapping.

TestComplete provides a number of keyword test operations that you can use to call a certain object method:

If the executed object method returns a value, the operation returns that value. For detailed information on how to obtain the operation result, see Checking Operation Result.

Using the On-Screen Action Operation

Using this operation, you can call specific methods of onscreen objects. For detailed information, see the operation's description.

To configure the operation, do the following:

  • Add the On-Screen Action operation to your keyword test. This will invoke the wizard.
  • Specify the object whose method you want to call and press Next.
  • Select the needed method from the list of available methods and properties. Press Next.
  • If the specified method has parameters, specify them on the next page of the wizard.
  • Press Finish to finish configuring the operation.

Using the Run Code Snippet Operation

The Run Code Snippet operation executes the specified script statement from your test. That is, you can specify a single-line script statement that calls the needed method. For detailed information, see the operation's description.

To configure the operation do the following:

  • Add the Run Code Snippet operation to your keyword test. This will invoke the wizard.
  • Specify the code line to be executed. To add a window or control object to the code expression, press Select Object and then choose the desired window or control in the ensuing Select Object dialog.
  • Press OK to finish editing the operation.

Using the Call Object Method Operation

Use this operation to call a certain method of the specified object. Note that this operation lets you operate not only with onscreen objects, but also with objects provided by TestComplete (Log or Regions, for instance). For detailed information, see the operation's description.

To configure the operation, do the following:

  • Add the Call Object Method operation to your keyword test. This will invoke the wizard.
  • Specify the object whose method you want to call. To select a window or control object, press Select Object and then choose the desired window or control in the ensuing Select Object dialog. After you specify the desired object, press Next.
  • Select the needed method from the list of available methods and properties. Press Next.
  • If the specified method has parameters, specify them on the next page of the wizard.
  • Press Finish to finish configuring the operation.
Tip: You can also modify parameters of the operations that are already added to the test. To do this, use special dialogs and in-place editors of the Keyword Test editor.
Highlight search results