aqPerformance.Check Method

Applies to TestComplete 15.45, last modified on December 01, 2022

Description

Use aqPerformance.Check to compare the time measured by a time counter with the specified limit. This method returns a boolean result and also posts the results to the test log.

Declaration

aqPerformance.Check(MaxExecTime, OperationName, CounterName)

MaxExecTime [in]    Required    Integer    
OperationName [in]    Optional    String Default value: MaxExecTime as a string   
CounterName [in]    Optional    String Default value: DefaultCounter   
Result Boolean

Applies To

The method is applied to the following object:

Parameters

The method has the following parameters:

MaxExecTime

The time limit for the counter, in milliseconds.

OperationName

The checkpoint name that will be included in the log message:

The checkpoint '<NAME>' for the performance counter '<COUTNER NAME>' passed/failed.

If omitted, defaults to the number of milliseconds specified by MaxExecTime.

CounterName

The counter name that was used in the aqPerformance.Start method. Omit the name to use the default counter.

Result Value

If the elapsed time of the specified counter is less than or equal to the specified maximum execution time, the method returns True and posts a checkpoint message to the test log. Otherwise, the method returns False and posts an error message to the test log.

Example

The code below demonstrates how to check the execution time by using a time counter:

JavaScript, JScript

function checkTime()
{
  // Start a time counter
  aqPerformance.Start();
  
  // Do some actions
  
  // Check if the action takes less than 5 sec
  aqPerformance.Check(5000);
}

Python

def checkTime():
  # Start a time counter
  aqPerformance.Start()

  # Do some actions
  
  # Check if the action takes less than 5 sec
  aqPerformance.Check(5000)

VBScript

Sub checkTime()
  ' Start a time counter
  aqPerformance.Start()
  
  ' Do some actions
  
  ' Check if the action takes less than 5 sec
  aqPerformance.Check(5000)
End Sub

DelphiScript

function checkTime();
begin
  // Start a time counter
  aqPerformance.Start();
  
  // Do some actions
  
  // Check if the action takes less than 5 sec
  aqPerformance.Check(5000);
end;

C++Script, C#Script

function checkTime()
{
  // Start a time counter
  aqPerformance["Start"]();
  
  // Do some actions
  
  // Check if the action takes less than 5 sec
  aqPerformance["Check"](5000);
}

See Also

aqPerformance Object
Start Method
Value Property
Measuring Test Run Time

Highlight search results