Log.FolderFileAndLinkCount Property

Applies to TestComplete 14.71, last modified on April 22, 2021

Description

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

Declaration

Log.FolderFileAndLinkCount(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 file and link messages in the given log folder.

Example

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

JavaScript, JScript

function FileAndLinkCount()
{
  // Creates a new folder in the test log
  var FoldID = Log.CreateFolder("MyNewFolder");
  Log.PushLogFolder(FoldID);
  Log.File("C:\\Work\\MyFile.txt");
  // ...
  Log.PopLogFolder();
  // ...
  // Obtains the number of files and links the folder contains
  var Num = Log.FolderFileAndLinkCount(FoldID);
  
  // Checks whether the folder contains files and links
  if ( Num > 0 )
    Log.Message("The folder contains " + Num + " files and links.");
  else
    Log.Message("The folder contains neither files nor links.");
}

Python

def FileAndLinkCount():
  # Creates a new folder in the test log
  FoldID = Log.CreateFolder("MyNewFolder")
  Log.PushLogFolder(FoldID)
  Log.File("C:\\Work\\MyFile.txt")
  # ...
  Log.PopLogFolder()
  # ...
  # Obtains the number of files and links the folder contains
  Num = Log.FolderFileAndLinkCount[FoldID]
  # Checks whether the folder contains files and links
  if Num > 0:
    Log.Message("The folder contains " + str(Num) + " files and links.")
  else:
    Log.Message("The folder contains neither files nor links.")

VBScript

Sub FileAndLinkCount()

  ' Creates a new folder in the test log
  FoldID = Log.CreateFolder("MyNewFolder")
  Log.PushLogFolder(FoldID)
  Log.File("C:\Work\MyFile.txt")
  ' ...
  Log.PopLogFolder()
  ' ...
  ' Obtains the number of files and links the folder contains
  Num = Log.FolderFileAndLinkCount(FoldID)
  
  ' Checks whether the folder contains files and links
  If Num > 0 Then
    Log.Message("The folder contains " & Num & " files and links.")
  Else
    Log.Message("The folder contains neither files nor links.")
  End If
  
End Sub

DelphiScript

function FileAndLinkCount;
var FoldID, Num;
begin

  // Creates a new folder in the test log
  FoldID := Log.CreateFolder('MyNewFolder');
  Log.PushLogFolder(FoldID);
  Log.File('C:\Work\MyFile.txt');
  // ...
  Log.PopLogFolder;
  // ...
  // Obtains the number of files and links the folder contains
  Num := Log.FolderFileAndLinkCount(FoldID);
  
  // Checks whether the folder contains files and links
  if ( Num > 0 ) then
    Log.Message('The folder contains ' + Num + ' files and links.')
  else
    Log.Message('The folder contains neither files nor links.');

end;

C++Script, C#Script

function FileAndLinkCount()
{
  // Creates a new folder in the test log
  var FoldID = Log["CreateFolder"]("MyNewFolder");
  Log["PushLogFolder"](FoldID);
  Log["File"]("C:\\Work\\MyFile.txt");
  // ...
  Log["PopLogFolder"]();
  // ...
  // Obtains the number of files and links the folder contains
  var Num = Log["FolderFileAndLinkCount"](FoldID);
  
  // Checks whether the folder contains files and links
  if ( Num > 0 )
    Log["Message"]("The folder contains " + Num + " files and links.");
  else
    Log["Message"]("The folder contains neither files nor links.");
}

See Also

Test Results
Link Method
File Method
LinkCount Property
FileCount Property
FolderWrnCount Property
FolderMsgCount Property
FolderEvnCount Property
FolderImgCount Property
FolderErrCount Property
FolderCount Method
CreateFolder Method

Highlight search results