HISUtils Object

Applies to TestComplete 14.0, last modified on January 23, 2019

Description

The HISUtils object provides a scripting interface to the RegExpr and StopWatch objects that extend the TestComplete functionality. The RegExpr object adds the ability to use regular expressions in DelphiScript units. Regular expressions are very powerful tools that have many applications, for example, search/replace operations or data verification. The StopWatch object is used for measuring time intervals. Unlike the RegExpr, it can be used in all of TestComplete supported scripting languages.

The HISUtils object is available only if the HISUtils plugin (<TestComplete>\Bin\Extensions\tcHISUtils.pls) is installed. For information on how to install plugins in TestComplete, see Installing Extensions.

Members

Example

The code below demonstrates how you can use the StopWatch property to find out how long it took your test to get executed:

JavaScript, JScript

function GetTest1Time()
{
  var StopWatchObj = HISUtils.StopWatch;
  StopWatchObj.Start();
  Test1();
  StopWatchObj.Stop();
  Log.Message("Test1 finished. Execution time: " + StopWatchObj.ToString());
}

Python

def GetTest1Time():
  StopWatchObj = HISUtils.StopWatch
  StopWatchObj.Start()
  Test1()
  StopWatchObj.Stop()
  Log.Message("Test1 finished. Execution time: " + StopWatchObj.ToString())

VBScript

Sub GetTest1Time
  Set StopWatchObj = HISUtils.StopWatch
  StopWatchObj.Start
  Test1
  StopWatchObj.Stop
  Log.Message("Test1 finished. Execution time: " & StopWatchObj.ToString)
End Sub

DelphiScript

procedure GetTest1Time;
var
  StopWatchObj : OleVariant;
begin
  StopWatchObj := HISUtils.StopWatch;
  StopWatchObj.Start;
  Test1;
  StopWatchObj.Stop;
  Log.Message('Test1 finished. Execution time: ' + StopWatchObj.ToString);
end;

C++Script, C#Script

function GetTest1Time()
{
  var StopWatchObj = HISUtils["StopWatch"];
  StopWatchObj["Start"]();
  Test1();
  StopWatchObj["Stop"]();
  Log.Message("Test1 finished. Execution time: " + StopWatchObj["ToString"]());
}

See Also

Installing Extensions
TestComplete Helper Objects

Highlight search results