Log.FolderImgCount Property

Applies to TestComplete 15.47, last modified on January 20, 2023

Description

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

Declaration

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

Example

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

JavaScript, JScript

function ImgCount()
{
  // Creates a new folder in the test log
  var FoldID = Log.CreateFolder("MyNewFolder");
  Log.PushLogFolder(FoldID);
  Log.Picture("C:\\MyImg.jpg");
  // ...
  Log.PopLogFolder();
  // ...
  // Obtains the number of images in the folder
  var Num = Log.FolderImgCount(FoldID);
  
  // Checks whether the folder contains images
  if ( Num > 0 )
    Log.Message("The folder contains " + Num + " image(s).");
  else
    Log.Message("The folder contains no images.");
}

Python

def ImgCount():
  # Creates a new folder in the test log
  FoldID = Log.CreateFolder("MyNewFolder")
  Log.PushLogFolder(FoldID)
  Log.Picture("C:\\Work\MyImg.jpg")
  # ...
  Log.PopLogFolder()
  # ...
  # Obtains the number of images in the folder 
  Num = Log.FolderImgCount[FoldID]
  # Checks whether the folder contains images
  if Num > 0:
    Log.Message("The folder contains " + str(Num) + " image(s).")
  else:
    Log.Message("The folder contains no images.")

VBScript

Sub ImgCount()

  ' Creates a new folder in the test log
  FoldID = Log.CreateFolder("MyNewFolder")
  Log.PushLogFolder(FoldID)
  Log.Picture("C:\MyImg.jpg")
  ' ...
  Log.PopLogFolder()
  ' ...
  ' Obtains the number of images in the folder
  Num = Log.FolderImgCount(FoldID)
  
  ' Checks whether the folder contains images
  If Num > 0 Then
    Log.Message("The folder contains " & Num & " image(s).")
  Else
    Log.Message("The folder contains no images.")
  End If
  
End Sub

DelphiScript

function ImgCount;
var FoldID, Num;
begin

  // Creates a new folder in the test log
  FoldID := Log.CreateFolder('MyNewFolder');
  Log.PushLogFolder(FoldID);
  Log.Picture('C:\MyImg.jpg');
  // ...
  Log.PopLogFolder;
  // ...
  // Obtains the number of images in the folder
  Num := Log.FolderImgCount(FoldID);
  
  // Checks whether the folder contains images
  if ( Num > 0 ) then
    Log.Message('The folder contains ' + Num + ' image(s).')
  else
    Log.Message('The folder contains no images.');

end;

C++Script, C#Script

function ImgCount()
{
  // Creates a new folder in the test log
  var FoldID = Log["CreateFolder"]("MyNewFolder");
  Log["PushLogFolder"](FoldID);
  Log["Picture"]("C:\\MyImg.jpg");
  // ...
  Log["PopLogFolder"]();
  // ...
  // Obtains the number of images in the folder
  var Num = Log["FolderImgCount"](FoldID);
  
  // Checks whether the folder contains images
  if ( Num > 0 )
    Log["Message"]("The folder contains " + Num + " image(s).");
  else
    Log["Message"]("The folder contains no images.");
}

See Also

Test Results
Picture Method
ImgCount Property
FolderWrnCount Property
FolderMsgCount Property
FolderEvnCount Property
FolderErrCount Property
FolderFileAndLinkCount Property
FolderCount Method
CreateFolder Method

Highlight search results