Start Method

Applies to TestComplete 15.0, last modified on November 17, 2021

Description

The StopWatch.Start method starts the timing.

Declaration

StopWatchObj.Start()

StopWatchObj An expression, variable or parameter that specifies a reference to a StopWatch object
Result None

Applies To

The method is applied to the following object:

Result Value

None.

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

Reset Method
Split Method
Stop Method
ToString Method

Highlight search results