Log.FolderWrnCount Property

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

Description

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

Declaration

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

Example

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

Note: Before running the script, disable the Stop on warning project option.

JavaScript, JScript

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

Python

def WrnCount():
  # Creates a new folder in the test log
  FoldID = Log.CreateFolder("MyNewFolder")
  Log.PushLogFolder(FoldID)
  Log.Warning("Test warning")
  # ...
  Log.PopLogFolder()
  # ...
  # Obtains the number of warnings in the folder 
  Num = Log.FolderWrnCount[FoldID]
  # Checks whether the folder contains warnings
  if Num > 0:
    Log.Message("The folder contains " + str(Num) + " warning(s).")
  else:
    Log.Message("The folder contains no warnings.")

VBScript

Sub WrnCount()

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

DelphiScript

function WrnCount;
var FoldID, Num;
begin

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

end;

C++Script, C#Script

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

See Also

Test Results
Warning Method
WrnCount Property
FolderErrCount Property
FolderMsgCount Property
FolderEvnCount Property
FolderImgCount Property
FolderFileAndLinkCount Property
FolderCount Method
CreateFolder Method

Highlight search results