Log.WrnCount Property

Applies to TestComplete 15.63, last modified on April 23, 2024

Description

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

Declaration

Log.WrnCount

Read-Only Property Integer

Applies To

The property is applied to the following object:

Property Value

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

Example

The code below obtains the total number of warning messages posted to the test log by the current test item and then posts this number to the test log.

JavaScript, JScript

function WrnCount()
{
  // ...
  // Obtains the total number of warning messages
  // posted to the test log
  var Num = Log.WrnCount;
  
  if ( Num > 0 )
    Log.Message("The test log contains " + Num + " warning message(s).");
  else
    Log.Message("The test log contains no warning messages.");
}

Python

def WrnCount():
  # ...
  # Obtains the total number of warning messages
  # posted to the test log
  Num = Log.WrnCount
  if Num > 0:
    Log.Message("The test log contains " + str(Num) + " warning message(s).")
  else:
    Log.Message("The test log contains no warning messages.")

VBScript

Sub WrnCount()
  ' ...
  ' Obtains the total number of warning messages
  ' posted to the test log
  Num = Log.WrnCount
  
  If Num > 0 Then
    Log.Message("The test log contains " & Num & " warning message(s).")
  Else
    Log.Message("The test log contains no warning messages.")
  End If

End Sub

DelphiScript

function WrnCount;
var Num;
begin

  // ...
  // Obtains the total number of warning messages
  // posted to the test log
  Num := Log.WrnCount;
  
  if ( Num > 0 ) then
    Log.Message('The test log contains ' + Num + ' warning message(s).')
  else
    Log.Message('The test log contains no warning messages.');

end;

C++Script, C#Script

function WrnCount()
{
  // ...
  // Obtains the total number of warning messages
  // posted to the test log
  var Num = Log["WrnCount"];
  
  if ( Num > 0 )
    Log["Message"]("The test log contains " + Num + " warning message(s).");
  else
    Log["Message"]("The test log contains no warning messages.");
}

See Also

Test Results
Warning Method
FolderWrnCount Property
ErrCount Property
MsgCount Property
EvnCount Property
ImgCount Property
FileCount Property
LinkCount Property
FolderCount Method

Highlight search results