Log.FolderEvnCount Property

Applies to TestComplete 14.40, last modified on April 22, 2021

Description

Returns the number of event messages (messages added via Log.Event) posted to the specified log folder and all of its subfolders during the current test item run.

Declaration

Log.FolderEvnCount(FolderID)

Read-Only Property Integer
FolderID [in]    Required    Integer    

Applies To

The property is applied to the following object:

Parameters

The property has the following parameter:

FolderID

The identifier of the needed log folder. To get the folder's identifier, use the Log.CreateFolder method.

Property Value

An integer value that indicates the number of event messages in the given log folder.

Example

The code below creates a new folder in the test log, then, at the end of the test, obtains the total number of events that belong to this folder and posts this number to the test log.

JavaScript, JScript

function EventCount()
{
  // Creates a new folder in the test log
  var FoldID = Log.CreateFolder("MyNewFolder");
  Log.PushLogFolder(FoldID);
  Log.Event("Test event");
  // ...
  Log.PopLogFolder();
  // ...
  // Obtains the number of events in the folder
  var Num = Log.FolderEvnCount(FoldID);
  
  // Checks whether the folder contains events
  if ( Num > 0 )
    Log.Message("The folder contains " + Num + " event(s).");
  else
    Log.Message("The folder contains no events.");
}

Python

def EventCount():
  # Creates a new folder in the test log
  FoldID = Log.CreateFolder("MyNewFolder")
  Log.PushLogFolder(FoldID)
  Log.Event("Test event")
  # ...
  Log.PopLogFolder()
  # ...
  # Obtains the number of events in the folder 
  Num = Log.FolderEvnCount[FoldID]
  # Checks whether the folder contains events
  if Num > 0:
    Log.Message("The folder contains " + str(Num) + " event(s).")
  else:
    Log.Message("The folder contains no events.")

VBScript

Sub EventCount()

  ' Creates a new folder in the test log
  FoldID = Log.CreateFolder("MyNewFolder")
  Log.PushLogFolder(FoldID)
  Log.Event("Test event")
  ' ...
  Log.PopLogFolder()
  ' ...
  ' Obtains the number of events in the folder
  Num = Log.FolderEvnCount(FoldID)
  
  ' Checks whether the folder contains events
  If Num > 0 Then
    Log.Message("The folder contains " & Num & " event(s).")
  Else
    Log.Message("The folder contains no events.")
  End If
  
End Sub

DelphiScript

function EventCount;
begin
  // Creates a new folder in the test log
  FoldID := Log.CreateFolder('MyNewFolder');
  Log.PushLogFolder(FoldID);
  Log.Event('Test event');
  // ...
  Log.PopLogFolder;
  // ...
  // Obtains the number of events in the folder
  Num := Log.FolderEvnCount(FoldID);
  
  // Checks whether the folder contains events
  if ( Num > 0 ) then
    Log.Message('The folder contains ' + Num + ' event(s).')
  else
    Log.Message('The folder contains no events.');

end;

C++Script, C#Script

function EventCount()
{
  // Creates a new folder in the test log
  var FoldID = Log["CreateFolder"]("MyNewFolder");
  Log["PushLogFolder"](FoldID);
  Log["Event"]("Test event");
  // ...
  Log["PopLogFolder"]();
  // ...
  // Obtains the number of events in the folder
  var Num = Log["FolderEvnCount"](FoldID);
  
  // Checks whether the folder contains events
  if ( Num > 0 )
    Log["Message"]("The folder contains " + Num + " event(s).");
  else
    Log["Message"]("The folder contains no events.");
}

See Also

Test Results
Event Method
EvnCount Property
FolderWrnCount Property
FolderMsgCount Property
FolderErrCount Property
FolderImgCount Property
FolderFileAndLinkCount Property
FolderCount Method
CreateFolder Method

Highlight search results