Log.EvnCount Property

Applies to TestComplete 15.70, last modified on December 17, 2024

Description

Returns the number of event messages (that is, messages added via Log.Event) posted to the test log during the current run of the current test item.

Declaration

Log.EvnCount

Read-Only Property Integer

Applies To

The property is applied to the following object:

Property Value

An integer value that means the number of event messages in the test log.

Example

The code below obtains the total number of events posted to the test log and then checks whether this number is not null.

JavaScript, JScript

function EvnCount()
{
  // ...
  
  // Obtains the total number of events
  // posted to the current test log
  var EvnCount = Log.EvnCount;
  
  // Checks whether there are some events
  if ( EvnCount > 0 )
    Log.Message("There is(are) " + EvnCount + " event(s) in the test log.");
  else
    Log.Message("There are no events in the test log.");
}

Python

def EvnCount():
  # ...
  # Obtains the total number of events
  # posted to the current test log
  EvnCount = Log.EvnCount
  # Checks whether there are some events
  if EvnCount > 0:
    Log.Message("There is(are) " + str(EvnCount) + " event(s) in the test log.")
  else:
    Log.Message("There are no events in the test log.")

VBScript

Sub EvnCount()

  ' ...
  
  ' Obtains the total number of events
  ' posted to the current test log
  EvnCount = Log.EvnCount
  
  ' Checks whether there are some events
  If EvnCount > 0 Then
    Log.Message("There is(are) " & EvnCount & " event(s) in the test log.")
  Else
    Log.Message("There are no events in the test log.")
  End If
  
End Sub

DelphiScript

function EvnCount;
var EvnCount;
begin

  // ...
  
  // Obtains the total number of events
  // posted to the current test log
  EvnCount := Log.EvnCount;
  
  // Checks whether there are some events
  if ( EvnCount > 0 ) then
    Log.Message('There is(are) ' + EvnCount + ' event(s) in the test log.')
  else
    Log.Message('There are no events in the test log.');

end;

C++Script, C#Script

function EvnCount()
{
  // ...
  
  // Obtains the total number of events
  // posted to the current test log
  var EvnCount = Log["EvnCount"];
  
  // Checks whether there are some events
  if ( EvnCount > 0 )
    Log["Message"]("There is(are) " + EvnCount + " event(s) in the test log.");
  else
    Log["Message"]("There are no events in the test log.");
}

See Also

Test Results
Event Method
FolderEvnCount Property
WrnCount Property
MsgCount Property
ErrCount Property
ImgCount Property
FileCount Property
LinkCount Property
FolderCount Method

Highlight search results