Log.EvnCount Property

Applies to TestComplete 14.20, last modified on September 11, 2019

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
Log.Event Method
Log.FolderEvnCount Property
Log.WrnCount Property
Log.MsgCount Property
Log.ErrCount Property
Log.ImgCount Property
Log.FileCount Property
Log.LinkCount Property
Log.FolderCount Method

Highlight search results