Log.ErrCount Property

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

Description

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

Declaration

Log.ErrCount

Read-Only Property Integer

Applies To

The property is applied to the following object:

Property Value

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

Example

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

JavaScript, JScript

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

Python

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

VBScript

Sub ErrCount()

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

DelphiScript

function ErrCount;
var ErrCount;
begin

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

end;

C++Script, C#Script

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

See Also

Test Results
Error Method
FolderErrCount Property
WrnCount Property
MsgCount Property
EvnCount Property
ImgCount Property
FileCount Property
LinkCount Property
FolderCount Method

Highlight search results