Occurs before the test engine posts an event notification to the test log.
Declaration
Sender | [in] | Required | Variant | |
LogParams | [in] | Required | A LogParams object |
Description
This event occurs before the test engine posts an event notification to the test log. You can create the OnLogEvent
handler to perform needed actions upon posting event messages to the log.
The test engine posts event messages when the test simulates actions over a window. You can change the priority of these event messages if these actions are simulated over the main window of the tested application.
Parameters
The event has the following parameters:
Sender
The Event control that processes the event.
Remarks
For information on how to create an event handler for this and other TestComplete events, see Handling Events.
If you configure your test project to track Selenium Server events during the test run, keep in mind that TestComplete does not support creating handlers for those events.
Example
JavaScript, JScript
function ProjectEvents1_OnLogEvent(Sender, LogParams)
{
var w;
w = Sys.Process("TestedApp").Window("MainWindow", "*", -1);
if (Sys.Desktop.ActiveWindow().Name == w.Name)
LogParams.Priority = pmHigher;
}
Python
def ProjectEvents1_OnLogEvent(Sender, LogParams):
w = Sys.Process("TestedApp").Window("MainWindow", "*", -1)
if (Sys.Desktop.ActiveWindow().Name == w.Name):
LogParams.Priority = pmHigher
VBScript
Sub ProjectEvents1_OnLogEvent(Sender, LogParams)
Set w = Sys.Process("TestedApp").Window("MainWindow", "*", -1)
If Sys.Desktop.ActiveWindow.Name = w.Name Then
LogParams.Priority = pmHigher
End If
End Sub
DelphiScript
procedure ProjectEvents1_OnLogEvent(Sender, LogParams : OleVariant);
var
w : OleVariant;
begin
w := Sys.Process('TestedApp').Window('MainWindow', '*', -1);
if Sys.Desktop.ActiveWindow.Name = w.Name then
LogParams.Priority := pmHigher;
end;
C++Script, C#Script
function ProjectEvents1_OnLogEvent(Sender, LogParams)
{
var w;
w = Sys["Process"]("TestedApp")["Window"]("MainWindow", "*", -1);
if (Sys["Desktop"]["ActiveWindow"]()["Name"] == w["Name"])
LogParams["Priority"] = pmHigher;
}
See Also
Posting Messages to the Log
LogParams Object
OnLogMessage Event
OnLogError Event
OnLogWarning Event
OnLogCheckpoint Event
OnLogPicture Event
OnLogFile Event
OnLogLink Event
Handling Events
Event Control