ItemName Property

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

Description

The ItemName property lets you get or set the application’s name in the Tested Applications collection. This name is specified in the Name parameter of the TestedApps editor and is used as the item display name in the Project Explorer. It is also used to refer to the corresponding item in the Tested Applications collection from tests, for example, TestedApps.AppName.

Declaration

ProgObj.ItemName

Read-Write Property String
ProgObj An expression, variable or parameter that specifies a reference to one of the objects listed in the Applies To section

Applies To

The property is applied to the following objects:

Property Value

A string holding the application’s name as it is specified in the Tested Applications collection.

Example

The following script posts a list of the project’s tested applications to the test log.

JavaScript, JScript

function Test()
{
  if (TestedApps.Count > 0)
  {
    Log.Message("The project contains the following tested applications:");

    for (var i = 0; i < TestedApps.Count; i++)
      Log.Message(TestedApps.Items(i).ItemName);
  }
  else
    Log.Message("The project does not contain tested applications.");
}

Python

def Test():
  Count = TestedApps.Count
  if TestedApps.Count > 0:
    Log.Message("The project contains the following tested applications:")
    for i in range(0, Count):
      Log.Message(TestedApps.Items[i].ItemName)
  else:
    Log.Message("The project does not contain tested applications.")

VBScript

Sub Test
  Dim i
  If TestedApps.Count > 0 Then
    Log.Message "The project contains the following tested applications:"

    For i = 0 To TestedApps.Count - 1
      Log.Message TestedApps.Items(i).ItemName
    Next
  Else
    Log.Message "The project does not contain tested applications."
  End If
End Sub

DelphiScript

procedure Test;
var i;
begin
  if TestedApps.Count > 0 then
  begin
    Log.Message('The project contains the following tested applications:');

    for i := 0 to TestedApps.Count - 1 do
      Log.Message(TestedApps.Items[i].ItemName);
  end
  else
    Log.Message('The project does not contain tested applications.');
end;

C++Script, C#Script

function Test()
{
  if (TestedApps["Count"] > 0)
  {
    Log["Message"]("The project contains the following tested applications:");

    for (var i = 0; i < TestedApps["Count"]; i++)
      Log["Message"](TestedApps["Items"](i)["ItemName"]);
  }
  else
    Log["Message"]("The project does not contain tested applications.");
}

See Also

TestedApp Object
AndroidTestedApp Object
ClickOnceTestedApp Object
BrowserTestedApp Object
FileName Property
Path Property

Highlight search results