aqPerformance Object

Applies to TestComplete 14.10, last modified on June 5, 2019

Description

The aqPerformance object allows you to measure time execution of a test or its parts.

Members

Example

The code below demonstrates how to use two named time counters:

JavaScript, JScript

function Test()
{
  
  // Start a time counter
  aqPerformance.Start("RunApps");
  
  // Run the tested application
  TestedApps.Notepad.Run();
  
  // Log the time of the application startup, in ms.
  Log.Message(aqPerformance.Value("RunApps"));
  
  // Start the second time counter
  aqPerformance.Start("EnteringTextCounter");
  
  // Enter text in the application
  Sys.Process("notepad").Window("Notepad", "Untitled - Notepad", 1).Keys("Sample Text");
  
  // Check if text entering takes less than 1 sec. by using the second time counter
  aqPerformance.Check(1000, "Entering Text", "EnteringTextCounter");
}

Python

def Test():
  # Start a time counter
  aqPerformance.Start("RunApps")
  
  # Run the tested application
  TestedApps.Notepad.Run()
  
  # Log the time of the application startup, in ms.
  Log.Message(aqConvert.IntToStr(aqPerformance.Value["RunApps"]))
  
  # Start the second time counter
  aqPerformance.Start("EnteringTextCounter")
  
  # Enter text in the application
  Sys.Process("notepad").Window("Notepad", "Untitled - Notepad", 1).Keys("Sample Text")
  
  # Check if text entering takes less than 1 sec. by using the second time counter
  aqPerformance.Check(1000, "Entering Text", "EnteringTextCounter")

VBScript

Sub Test()
  
  ' Start a time counter
  aqPerformance.Start("RunApps")
  
  ' Run the tested application
  TestedApps.Notepad.Run()
  
  ' Log the time of the application startup, in ms.
  Log.Message(aqPerformance.Value("RunApps"))
  
  ' Start the second time counter
  aqPerformance.Start("EnteringTextCounter")
  
  ' Enter text in the application
  Sys.Process("notepad").Window("Notepad", "Untitled - Notepad", 1).Keys("Sample Text")
  
  ' Check if text entering takes less than 1 sec. by using the second time counter
  Call aqPerformance.Check(1000, "Entering Text", "EnteringTextCounter")
End Sub

DelphiScript

function Test();
begin
  // Start a time counter
  aqPerformance.Start('RunApps');
  
  // Run the tested application
  TestedApps.Notepad.Run();
  
  // Log the time of the application startup, in ms.
  Log.Message(aqPerformance.Value('RunApps'));
  
  // Start the second time counter
  aqPerformance.Start('EnteringTextCounter');
  
  // Enter text in the application
  Sys.Process('notepad').Window('Notepad', 'Untitled - Notepad', 1).Keys('Sample Text');
  
  // Check if text entering takes less than 1 sec. by using the second time counter
  aqPerformance.Check(1000, 'Entering Text', 'EnteringTextCounter');
end;

C++Script, C#Script

function Test()
{
  
  // Start a time counter
  aqPerformance["Start"]("RunApps");
  
  // Run the tested application
  TestedApps["Notepad"]["Run"]();
  
  // Log the time of the application startup, in ms.
  Log["Message"](aqPerformance["Value"]("RunApps"));
  
  // Start the second time counter
  aqPerformance["Start"]("EnteringTextCounter");
  
  // Enter text in the application
  Sys["Process"]("notepad")["Window"]("Notepad", "Untitled - Notepad", 1)["Keys"]("Sample Text");
  
  // Check if text entering takes less than 1 sec. by using the second time counter
  aqPerformance["Check"](1000, "Entering Text", "EnteringTextCounter");
}

See Also

Measuring Test Run Time
TestComplete Helper Objects
aqConvert Object
aqDateTime Object
aqEnvironment Object
aqFile Object
aqFileSystem Object
aqObject Object
aqString Object
aqUtils Object

Highlight search results