Log.FolderMsgCount Property

Applies to TestComplete 15.47, last modified on January 20, 2023

Description

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

Declaration

Log.FolderMsgCount(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 informative messages in the given log folder.

Example

The code below creates a new folder in the test log, then obtains the total number of informative messages in the folder and posts this number to the test log.

JavaScript, JScript

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

Python

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

VBScript

Sub MsgCount()

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

DelphiScript

function MsgCount;
var FoldID, Num;
begin

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

end;

C++Script, C#Script

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

See Also

Test Results
Message Method
MsgCount Property
FolderWrnCount Property
FolderErrCount Property
FolderEvnCount Property
FolderImgCount Property
FolderFileAndLinkCount Property
FolderCount Method
CreateFolder Method

Highlight search results