Log.WrnCount Property

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

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
Log.Warning Method
Log.FolderWrnCount Property
Log.ErrCount Property
Log.MsgCount Property
Log.EvnCount Property
Log.ImgCount Property
Log.FileCount Property
Log.LinkCount Property
Log.FolderCount Method

Highlight search results