ReturnValue Property

Applies to TestComplete 15.62, last modified on March 19, 2024

Description

The Runner.CallObjectMethodAsync function calls an object method asynchronously and returns a CallObjectMethodAsyncResult object. The ReturnValue property of this object provides access to the method’s result value.

Declaration

CallObjectMethodAsyncResultObj.ReturnValue

Read-Only Property Variant
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

Result value of the object method. If the method’s execution is not finished, or the method does not return a value, ReturnValue will return an empty Variant value.

Remarks

The ReturnValue property does not support object references. That is, it only lets you know the function result if this result is a non-object value: integer, string, boolean, date and so on.

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
CallObjectMethodAsync Method

Highlight search results