Applies to TestComplete 14.20, last modified on September 11, 2019

Description

Use the Call Object Method operation to call a method of some object from your keyword test or obtain or set the object’s properties.

This operation is similar to the Run Code Snippet operation which you can also use to call methods of an object. The difference is that the Call Object Method operation lets you specify the operation parameters using special dialogs, which makes the editing easier. However, you may find it easier to specify some expressions with the Run Code Snippet operation than set the operation parameters in the dialogs.

Requirements

In order for the operation to be able to call an object’s method, the object must exist at the moment of the operation execution.

The object must also exist when you are adding the operation to your keyword test.

Operation Result

The operation returns the same value, which the called method or property returns. For information on how to obtain this value, see Checking Operation Result.

Scripting Analogue

The operation is a keyword test analogue to calling the specified method or property from script.

Child Operations

The operation cannot have child operations.

Operation Parameters

The operation has the following parameters:

  • The object, with which the operation will work. This can be an object provided by TestComplete or a process, window or any other object of the tested application.

  • The name of the method or property to be called.

  • The method’s (or property’s) parameters, if any.

When adding the operation to your keyword test, TestComplete displays a wizard that lets you specify all these parameters. To specify parameters of the operation that is already added to the test, you use special dialogs and in-place editors provided by the Keyword Test editor. These dialogs and in-place editors are analogues to the wizard’s pages.

Specifying parameters when adding the operation

The wizard, that TestComplete displays when you are adding the operation to your test, contains the following pages:

Specify Object

On this page you can specify the name of the object with which the operation will work.

When typing the object name you can press Ctrl+Space to display the Code Completion window.

If the object is an on-screen window or control, then to specify it, you can click Select On-Screen Object and use the subsequent Select Object dialog to choose the desired window or control. See Selecting Objects for Keyword Test Operations.

If the object is one of TestComplete runtime objects, then to specify it, you can click Select Object and use the subsequent Select Runtime Object dialog to choose the desired object's name.

If the desired object's name is stored in a project suite, project or keyword test variable, then to specify it, you can click Select Variable and then use the subsequent Select Variable dialog to choose an existing variable or to create a new one.

Note that if the Map object names automatically setting is enabled, TestComplete will automatically map the window or control name after you selected this window or control in the dialog. This name will be used to address the object in tests. For more information on automatic name mapping, see About Name Mapping.

Specify Method or Property

On this page you can choose the method or property that belongs to the selected object and that the operation will call. For detailed information about methods and properties, see description of the object. If the method or property is provided by TestComplete, you can find the description in TestComplete help (see Searching for Information).

Note: If the selected object is a name mapping item or alias and the underlying test object does not exist, then by default the page will contain only those methods and properties that are available to name mapping items or aliases. You can view and select methods and properties of the underlying test object only if this object exists. You can also view and select these methods and properties for those objects that were mapped in a specific way. For more information about this, see Saving Information on Methods and Properties of Mapped Objects.
Operation Parameters

On this page you specify the parameters of the method (or property) that will be called by the operation. For information on the parameters, see the method (or property) description. If the method or property is provided by TestComplete, you can find the description by searching for the method (or property) name in TestComplete help file (see Searching for Information).

For more information on setting the values on the page, see Specifying Operation Parameters.

Modifying Parameters

After adding the operation to the test, you can modify the operation parameters with the same wizard that you used to add the operation. To invoke the wizard, simply double-click the operation’s row in the Keyword Test editor.

To modify parameters of the operation, you can also use the in-place editors and dialogs provided by the Keyword Test editor.

To specify another object, with which the operation will work:

  • Select the operation in the test.

  • Click within the Item cell twice (not a double-click), or select the cell and press F2. This will activate the in-place editor.

  • Click the ellipsis button of the in-place editor. This will invoke the Specify Object dialog that is similar to the Specify Object page of the wizard that was displayed when you added the operation to the test (see above).

  • Use the dialog to specify the desired object. Click OK to close the dialog.

  • Press Enter to apply the changes and close the in-place editor. Press Esc to discard the changes.

To choose another method or property to be called by the operation:

  • Select the operation in the test.

  • Click within the Operation cell twice (not a double-click), or select the cell and press F2. This will activate the in-place editor.

  • Select the desired property or method from the drop-down list.

  • Press Enter to apply the changes and close the in-place editor. Press Esc to discard the changes.

To specify the method or property parameters:

  • Select the operation in the test.

  • Click within the Value cell twice (not a double-click), or select the cell and press F2. This will activate the in-place editor.

  • Click the ellipsis button of the in-place editor. This will invoke the Operation Parameters dialog, in which you can specify the parameters. For detailed information on the parameters, see description of the method or property, to which the parameters belong.

  • Click OK in the dialog to save the changes.

  • Press Enter to apply the changes and close the in-place editor. Press Esc to discard the changes.

See Also

Test Actions Category
Specifying Operation Parameters
Selecting Objects for Keyword Test Operations
Checking Operation Result
Run Code Snippet Operation
On-Screen Action Operation
Calling Methods and Properties of "Internal" Objects

Highlight search results