Inserting Messages (Warnings, etc.) Into the Test Log

Applies to TestComplete 15.73, last modified on March 04, 2025

The following code inserts an information message into the test log.

JavaScript, JScript

Log.Message("Just a message");

Python

Log.Message("Just a message")

VBScript

Log.Message "Just a message"

DelphiScript

Log.Message('Just a message');

C++Script, C#Script

Log["Message"]("Just a message");

The following code inserts a warning message into the test log. The first parameter sets the message text (the current vertical mouse coordinate), the second parameter sets the remarks, the third sets the message priority (highest).

JavaScript, JScript

Log.Warning(Sys.Desktop.MouseY, "Additional notes", pmHighest); // highest priority

Python

Log.Warning(Sys.Desktop.MouseY, "Additional notes", pmHighest)# highest priority

VBScript

Log.Warning Sys.Desktop.MouseY, "Additional notes", pmHighest ' highest priority

DelphiScript

Log.Warning(Sys.Desktop.MouseY, 'Additional notes', pmHighest); // highest priority

C++Script, C#Script

Log["Warning"](Sys["Desktop"]["MouseY"], "Additional notes", pmHighest); // highest priority

The following code inserts an error message with normal priority, in bold italic red font.

JavaScript, JScript

var w, Attr;
w = "An error";
Attr = Log.CreateNewAttributes();
Attr.Bold = true;
Attr.Italic = true;
Attr.FontColor = 0x0000FF;
Log.Error(w, "Notes", pmNormal, Attr);

Python

w = "An error"
Attr = Log.CreateNewAttributes()
Attr.Bold = True
Attr.Italic = True
Attr.FontColor = 0x0000FF
Log.Error(w, "Notes", pmNormal, Attr)

VBScript

w = "An error"
Set Attr = Log.CreateNewAttributes
Attr.Bold = True
Attr.Italic = True
Attr.FontColor = &H0000FF
Log.Error w, "Notes", pmNormal, Attr

DelphiScript

var w, Attr: OleVariant;
...
w := 'An error';
Attr := Log.CreateNewAttributes;
Attr.Bold := True;
Attr.Italic := True;
Attr.FontColor := $0000FF;
Log.Error(w, 'Notes', pmNormal, Attr);

C++Script, C#Script

var w, Attr;
w = "An error";
Attr = Log["CreateNewAttributes"]();
Attr["Bold"] = true;
Attr["Italic"] = true;
Attr["FontColor"] = 0x0000FF;
Log["Error"](w, "Notes", pmNormal, Attr);

The following code inserts an event message, with normal priority, underlined yellow text on a blue background and a screenshot of the active window.

JavaScript, JScript

var Attr;
Attr = Log.CreateNewAttributes();
Attr.Underline = true;
Attr.FontColor = 0x00FFFF;
Attr.BackColor = 0xFF0000;
Log.Event("An event message", "", pmNormal, Attr, Sys.Desktop.ActiveWindow());

Python

Attr = Log.CreateNewAttributes()
Attr.Underline = True
Attr.FontColor = 0x00FFFF
Attr.BackColor = 0xFF0000
Log.Event("An event message", "", pmNormal, Attr, Sys.Desktop.ActiveWindow())

VBScript

Set Attr = Log.CreateNewAttributes
Attr.Underline = True
Attr.FontColor = &H00FFFF
Attr.BackColor = &HFF0000
Log.Event "An event message", "", pmNormal, Attr, Sys.Desktop.ActiveWindow

DelphiScript

var Attr: OleVariant;
...
Attr := Log.CreateNewAttributes;
Attr.Underline := True;
Attr.FontColor := $00FFFF;
Attr.BackColor := $FF0000;
Log.Error('An event message', '', pmNormal, Attr, Sys.Desktop.ActiveWindow);

C++Script, C#Script

var Attr;
Attr = Log["CreateNewAttributes"]();
Attr["Underline"] = true;
Attr["FontColor"] = 0x00FFFF;
Attr["BackColor"] = 0xFF0000;
Log["Error"]("An event message", "", pmNormal, Attr, Sys["Desktop"]["ActiveWindow"]());

Highlight search results