Completed Property

Applies to TestComplete 14.71, last modified on April 22, 2021

Description

The Runner.CallObjectMethodAsync function calls an object method asynchronously and returns a CallObjectMethodAsyncResult object that lets you detect whether the called method has finished and provides a scripting interface to the method's result. The Completed property of this method determines whether the function's execution has finished.

Declaration

CallObjectMethodAsyncResultObj.Completed

Read-Only Property Boolean
CallObjectMethodAsyncResultObj An expression, variable or parameter that specifies a reference to a CallObjectMethodAsyncResult object

Applies To

The property is applied to the following object:

Property Value

True if the method's execution has finished, False otherwise.

Example

The code below demonstrates how you can use methods of the CallObjectMethodAsync object.

JavaScript, JScript

function CallObjectMethodAsyncExample()
{
  // Calls method asynchronously
  var CallResultObj = Runner.CallObjectMethodAsync(Obj, "MethodName", "Param1", "Param2");
 
  // Performs the desired user actions
  // ...
 
  // Waits until the asynchronous call is over
  while (! CallResultObj.Completed )
    aqUtils.Delay(100);
 
  // Checks the results
  MethodResult = CallResultObj.ReturnValue;
}

Python

def CallObjectMethodAsyncExample():
  # Calls method asynchronously 
  CallResultObj = Runner.CallObjectMethodAsync(Obj, "MethodName", "Param1", "Param2")
  # Performs the desired user actions 
  # ... 
  # Waits until the asynchronous call is over 
  while not CallResultObj.Completed:
    aqUtils.Delay(100)
  # Checks the results 
  MethodResult = CallResultObj.ReturnValue

VBScript

Sub CallObjectMethodAsyncExample
  ' Calls method asynchronously
  Set CallResultObj = Runner.CallObjectMethodAsync(Obj, "MethodName", "Param1", "Param2")
 
  ' Performs the desired user actions
  ' ...
 
  ' Waits until the asynchronous call is over
  While Not CallResultObj.Completed
    aqUtils.Delay 100
  WEnd
 
  ' Checks the results
  MethodResult = CallResultObj.ReturnValue
End Sub

DelphiScript

function CallObjectMethodAsyncExample;
var CallResultObj, MethodResult;
begin
  // Calls method asynchronously
  CallResultObj := Runner.CallObjectMethodAsync(Obj, 'MethodName', 'Param1', 'Param2');
 
  // Performs the desired user actions
  // ...
 
  // Waits until the asynchronous call is over
  while (not CallResultObj.Completed ) do
    aqUtils.Delay(100);
 
  // Checks the results
  MethodResult := CallResultObj.ReturnValue;
end;

C++Script, C#Script

function CallObjectMethodAsyncExample()
{
  // Calls method asynchronously
  var CallResultObj = Runner["CallObjectMethodAsync"]( Obj, "MethodName", "Param1", "Param2" );
 
  // Performs the desired user actions
  // ...
 
  // Waits until the asynchronous call is over
  while (! CallResultObj["Completed"] )
    aqUtils["Delay"](100);
 
  // Checks the results
  MethodResult = CallResultObj["ReturnValue"];
}

See Also

Calling Methods Asynchronously
Testing Modal Windows

Highlight search results