Applies to TestComplete 14.70, last modified on October 26, 2020

Description

The StopWatch object adds the stopwatch functionality to TestComplete so that you can measure time intervals up to 100 hours long. To get the object in your tests, use the HISUtils.StopWatch property.

Requirements

The HISUtils object is available only if the HISUtils plugin is enabled.

This plugin is installed and enabled by default during the TestComplete installation. You can check the plugin status in the File > Install Extensions dialog in TestComplete. You can find the plugin in the Common group.

Members

Example

The following code snippet starts a test and measures how much time has been spent on it execution.

JavaScript, JScript

function Test()
{
  var StopWatch;
  StopWatch = HISUtils.StopWatch;
  // Starts the time counter
  StopWatch.Start();
  DoTest1();
  // Stops the time counter
  StopWatch.Stop();
  // Posts the passed time to the test log
  Log.Message("Test1 finished. Execution time: " + StopWatch.ToString());

}

Python

def Test():

  StopWatch = HISUtils.StopWatch
  # Starts the time counter
  StopWatch.Start()
  DoTest1()
  # Stops the time counter
  StopWatch.Stop()
  # Posts the passed time to the test log
  Log.Message("Test1 finished. Execution time: " + StopWatch.ToString())

VBScript

Sub Test

  Dim StopWatch
  Set StopWatch = HISUtils.StopWatch
  ' Starts the time counter
  StopWatch.Start
  DoTest1
  ' Stops the time counter
  StopWatch.Stop
  ' Posts the passed time to the test log
  Log.Message("Test1 finished. Execution time: " & StopWatch.ToString)

End Sub

DelphiScript

procedure Test();
var StopWatch;
begin
  StopWatch := HISUtils.StopWatch;
  // Starts the time counter
  StopWatch.Start;
  DoTest1;
  // Stops the time counter
  StopWatch.Stop;
  // Posts the passed time to the test log
  Log.Message('Test1 finished. Execution time: ' + StopWatch.ToString);

end;

C++Script, C#Script

function Test()
{
  var StopWatch;
  StopWatch = HISUtils["StopWatch"];
  // Starts the time counter
  StopWatch["Start"]();
  DoTest1();
  // Stops the time counter
  StopWatch["Stop"]();
  // Posts the passed time to the test log
  Log["Message"]("Test1 finished. Execution time: " + StopWatch["ToString"]());

}

See Also

HISUtils Object
Installing Extensions

Highlight search results