Log.FolderImgCount Property

Applies to TestComplete 14.0, last modified on January 23, 2019

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

About Test Log
Log.Picture Method
Log.ImgCount Property
Log.FolderWrnCount Property
Log.FolderMsgCount Property
Log.FolderEvnCount Property
Log.FolderErrCount Property
Log.FolderFileAndLinkCount Property
Log.FolderCount Method
Log.CreateFolder Method

Highlight search results