HISUtils Object

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

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.

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 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