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
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
About Test Log
Log.Warning Method
Log.WrnCount Property
Log.FolderErrCount Property
Log.FolderMsgCount Property
Log.FolderEvnCount Property
Log.FolderImgCount Property
Log.FolderFileAndLinkCount Property
Log.FolderCount Method
Log.CreateFolder Method