Description
The aqUtils
object provides various helper routines that let you extend tests with additional functionality.
Note that it is possible to skip the object’s name (aqUtils
) when calling its members in scripts. For example, the following two lines are equivalent:
JavaScript, JScript
Delay(5000);
Python
aqUtils.Delay(5000)
Delay(5000)
VBScript
Delay 5000
DelphiScript
Delay(5000);
C++Script, C#Script
Delay(5000);
Members
Example
The code below creates the specified file and then checks whether the file has been successfully created. If it has, the routine posts an informative message to the test log. Otherwise, an error occurs, and the routine posts a description of it to the test log.
JavaScript, JScript
function GettingErrorDescription()
{
// Specifies the path to the file
var sPath = "D:\\Files\\MyFile.txt";
// Creates the file
var Err = aqFile.Create(sPath);
if (Err)
Log.Message("The file was created successfully.")
else
{
// Obtains the error description
var Desc = aqUtils.SysErrorMessage(Err);
Log.Message(Desc);
}
}
Python
def GettingErrorDescription():
# Specifies the path to the file
sPath = "D:\\Files\\MyFile.txt"
# Creates the file
Err = aqFile.Create(sPath)
if Err:
Log.Message("The file was created successfully.")
else:
# Obtains the error description
Desc = aqUtils.SysErrorMessage(Err)
Log.Message(Desc)
VBScript
Sub GettingErrorDescription
' Specifies the path to the file
sPath = "D:\Files\MyFile.txt"
' Creates the file
Err = aqFile.Create(sPath)
If Err Then
Log.Message("The file was created successfully.")
Else
' Obtains the error description
Desc = aqUtils.SysErrorMessage(Err)
Log.Message(Desc)
End If
End Sub
DelphiScript
function GettingErrorDescription;
var sPath, Err, Desc;
begin
// Specifies the path to the file
sPath := 'D:\Files\MyFile.txt';
// Creates the file
Err := aqFile.Create(sPath);
if Err then
Log.Message('The file was created successfully.')
else
begin
// Obtains the error description
Desc := aqUtils.SysErrorMessage(Err);
Log.Message(Desc);
end;
end;
C++Script, C#Script
function GettingErrorDescription()
{
// Specifies the path to the file
var sPath = "D:\\Files\\MyFile.txt";
// Creates the file
var Err = aqFile["Create"](sPath);
if (Err)
Log["Message"]("The file was created successfully.")
else
{
// Obtains the error description
var Desc = aqUtils["SysErrorMessage"](Err);
Log["Message"](Desc);
}
}
See Also
TestComplete Helper Objects
aqConvert Object
aqDateTime Object
aqEnvironment Object
aqFile Object
aqFileSystem Object
aqObject Object
aqString Object