The count property of the object "aqFileSystem.GetFolderInfo(FolderName).Files.Count" is reported to be "unknown".
I'm using DelphiScript for testing some applications. I use the procedure shown below to check if the number of files and subfolders in a tested folder is as expected. The problem with this procedure is that TestComplete reports that "Count" is unknown. This error occurs not always. It is not clear to me what to do to make sure the procedure is always working (not complaining about the unknown "Count").
procedure TestNoOfFilesAndSubFoldersInFolder(FolderName, ExpectedNoOfFiles, ExpectedNoOfSubFolders);
var ActualNo;
begin
Log.Message(FolderName);
Log.Warning('The Count property is not recognized');
if FolderExists(FolderName) then
begin
ActualNo := aqFileSystem.GetFolderInfo(FolderName).Files.Count;
if ActualNo = ExpectedNoOfFiles then
LogSuccess(aqString.Format('The expected no. of files (%d) was found in folder %s', ExpectedNoOfFiles, FolderName))
else
LogWarning(aqString.Format('The no. of files (%d) differs from the expected no. (%d) for folder %s', ActualNo, xpectedNoOfFiles, FolderName));
ActualNo := aqFileSystem.GetFolderInfo(FolderName).SubFolders.Count;
if ActualNo = ExpectedNoOfSubFolders then
LogSuccess(aqString.Format('The expected no. of subfolders (%d) was found in folder %s', ExpectedNoOfSubFolders, FolderName))
else
LogWarning(aqString.Format('The no. of subfolders (%d) differs from the expected no. (%d) for folder %s', ActualNo, ExpectedNoOfSubFolders, FolderName));end;
end;
;