Log.FolderErrCount Property

Applies to TestComplete 14.0, last modified on January 23, 2019

Description

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

Declaration

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

Example

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

Note: Before running this script, set the Error handling > On error project property to Continue running.

JavaScript, JScript

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

Python

def ErrCount():
  # Creates a new folder in the test log
  FoldID = Log.CreateFolder("MyNewFolder")
  Log.PushLogFolder(FoldID)
  Log.Error("Test error")
  # ...
  Log.PopLogFolder()
  # ...
  # Obtains the number of errors in the folder 
  Num = Log.FolderErrCount(FoldID)
  # Checks whether the folder contains errors
  if Num > 0:
    Log.Message("The folder contains " + str(Num) + " error(s).")
  else:
    Log.Message("The folder contains no errors.")

VBScript

Sub ErrCount()

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

DelphiScript

function ErrCount;
var FoldID, Num;
begin

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

end;

C++Script, C#Script

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

See Also

About Test Log
Log.Error Method
Log.ErrCount Property
Log.FolderWrnCount Property
Log.FolderMsgCount Property
Log.FolderEvnCount Property
Log.FolderImgCount Property
Log.FolderFileAndLinkCount Property
Log.FolderCount Method
Log.CreateFolder Method

Highlight search results