Size Property

Applies to TestComplete 15.69, last modified on November 13, 2024

Description

The TestedApp.Size property returns the size (in bytes) of the executable or batch file of the given tested application.

Declaration

TestedAppObj.Size

Read-Only Property Integer
TestedAppObj An expression, variable or parameter that specifies a reference to a TestedApp object

Applies To

The property is applied to the following object:

Property Value

The integer that means the size of the application’s executable or batch file.

Example

The following code obtains information on the tested applications and posts it to the test log:

JavaScript, JScript

function Test()
{

  var TestApp, Count, i, Name, Path, Date, Time, Size;

  Count = TestedApps.Count;
  if (Count > 0)
    {
    Log.AppendFolder("The project contains the following tested applications:");
    for (i = 0; i < Count; i++)
      {
      // Obtains the tested application
      TestApp = TestedApps.Items(i);
      // Obtains the tested application’s name
      Name = TestApp.ItemName;
      // Obtains the full file name of the tested application
      Path = "File: " + TestApp.FullFileName;
      // Obtains the date of the tested application’s last modification
      Date = "Date: " + aqConvert.DateTimeToFormatStr(TestApp.Date, "%m/%d/%Y");
      // Obtains the time of the tested application’s last modification
      Time = "Time: " + aqConvert.DateTimeToFormatStr(TestApp.Time, "%H:%M:%S");
      // Obtains the size of the tested application
      Size = "Size: " + aqConvert.IntToStr(TestApp.Size) + " bytes";
      // Posts information on the tested application to the test log
      Log.Message(Name, Path + "\r\n" + Date + "\r\n" + Time + "\r\n" + Size)

      }
    }
  Log.PopLogFolder();

}

Python

def Test():
  Count = TestedApps.Count
  if Count > 0:
    Log.AppendFolder("The project contains the following tested applications:")
    for i in range(0, Count):
      # Obtains the tested application 
      TestApp = TestedApps.Items[i]
      # Obtains the tested application's name 
      Name = TestApp.ItemName
      # Obtains the full file name of the tested application 
      Path = "File: " + TestApp.FullFileName
      # Obtains the date of the tested application's last modification 
      Date = "Date: " + aqConvert.DateTimeToFormatStr(TestApp.Date, "%m/%d/%Y")
      # Obtains the time of the tested application's last modification 
      Time = "Time: " + aqConvert.DateTimeToFormatStr(TestApp.Time, "%H:%M:%S");
      # Obtains the size of the tested application 
      Size = "Size: " + aqConvert.IntToStr(TestApp.Size) + " bytes";
      # Posts information on the tested application to the test log 
      Log.Message(Name, Path + "\r\n" + Date + "\r\n" + Time + "\r\n" + Size)
  Log.PopLogFolder()

VBScript

Sub Test

  Dim TestApp, Count, i, Name, Path, Date, Time, Size

  Count = TestedApps.Count
  If Count > 0 Then
    Log.AppendFolder("The project contains the following tested applications:")
    For i = 0 To Count - 1

      ' Obtains the tested application
      Set TestApp = TestedApps.Items(i)
      ' Obtains the tested application’s name
      Name = TestApp.ItemName
      ' Obtains the full file name of the tested application
      Path = "File: " & TestApp.FullFileName
      ' Obtains the date of the tested application’s last modification
      Date = "Date: " & aqConvert.DateTimeToFormatStr(TestApp.Date, "%m/%d/%Y")
      ' Obtains the time of the tested application’s last modification
      Time = "Time: " & aqConvert.DateTimeToFormatStr(TestApp.Time, "%H:%M:%S")
      ' Obtains the size of the tested application
      Size = "Size: " & aqConvert.IntToStr(TestApp.Size) & " bytes"
      ' Posts information on the tested application to the test log
      Call Log.Message(Name, Path & vbCrLf & Date & vbCrLf & Time & vbCrLf & Size)

    Next
  End If
  Log.PopLogFolder

End Sub

DelphiScript

procedure Test();
var TestApp, Count, i, Name, Path, Date, Time, Size;

begin

  Count := TestedApps.Count;
  if Count > 0 then
    begin
    Log.AppendFolder('The project contains the following tested applications:');
    for i := 0 to Count - 1 do
      begin
      // Obtains the tested application
      TestApp := TestedApps.Items(i);
      // Obtains the tested application’s name
      Name := TestApp.ItemName;
      // Obtains the full file name of the tested application
      Path := 'File: ' + TestApp.FullFileName;
      // Obtains the date of the tested application’s last modification
      Date := 'Date: ' + aqConvert.DateTimeToFormatStr(TestApp.Date, '%m/%d/%Y');
      // Obtains the time of the tested application’s last modification
      Time := 'Time: ' + aqConvert.DateTimeToFormatStr(TestApp.Time, '%H:%M:%S');
      // Obtains the size of the tested application
      Size := 'Size: ' + aqConvert.IntToStr(TestApp.Size) + ' bytes';
      // Posts information on the tested application to the test log
      Log.Message(Name, Path + #13#10 + Date + #13#10 + Time + #13#10 + Size)

      end;
    end;
  Log.PopLogFolder;

end;

C++Script, C#Script

function Test()
{

  var TestApp, Count, i, Name, Path, Date, Time, Size;

  Count = TestedApps["Count"];
  if (Count > 0)
    {
    Log["AppendFolder"]("The project contains the following tested applications:");
    for (i = 0; i < Count; i++)
      {
      // Obtains the tested application
      TestApp = TestedApps["Items"](i);
      // Obtains the tested application’s name
      Name = TestApp["ItemName"];
      // Obtains the full file name of the tested application
      Path = "File: " + TestApp["FullFileName"];
      // Obtains the date of the tested application’s last modification
      Date = "Date: " + aqConvert["DateTimeToFormatStr"](TestApp["Date"], "%m/%d/%Y");
      // Obtains the time of the tested application’s last modification
      Time = "Time: " + aqConvert["DateTimeToFormatStr"](TestApp["Time"], "%H:%M:%S");
      // Obtains the size of the tested application
      Size = "Size: " + aqConvert["IntToStr"](TestApp["Size"]) + " bytes";
      // Posts information on the tested application to the test log
      Log["Message"](Name, Path + "\r\n" + Date + "\r\n" + Time + "\r\n" + Size)

      }
    }
  Log["PopLogFolder"]();

}

See Also

Path Property
ItemName Property
Time Property
Date Property

Highlight search results