Log.ErrCount Property

Applies to TestComplete 14.10, last modified on June 5, 2019

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
Log.Error Method
Log.FolderErrCount Property
Log.WrnCount Property
Log.MsgCount Property
Log.EvnCount Property
Log.ImgCount Property
Log.FileCount Property
Log.LinkCount Property
Log.FolderCount Method

Highlight search results