ProjectLocation Property (Specific to ProjectSuite Object)

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

Description

Use the TestItem.ProjectLocation property to obtain the file name of the project, tp which the given test item corresponds.

Declaration

ProjectSuite TestItemObj.ProjectLocation

Read-Only Property String
ProjectSuite TestItemObj An expression, variable or parameter that specifies a reference to a ProjectSuite TestItem object

Applies To

The property is applied to the following object:

Property Value

A string specifying the fully qualified file name of the project, to which the given test item corresponds.

Example

The following example iterates through a project’s test items and posts their properties to the test log:

JavaScript, JScript

function Test() {
  // Iterates through test items
  for (i = 0; i< ProjectSuite.TestItems.ItemCount; i++) {
    LogTestItemInfo(ProjectSuite.TestItems.TestItem(i));
  }
}

function LogTestItemInfo(ATestItem) {
  // Prints the test item name
  Log.AppendFolder(ATestItem.ProjectName);
  // Prints the test item description
  Log.Message(ATestItem.Description);
  // Prints the corresponding project location
  Log.Message(ATestItem.ProjectLocation);
  // Determines whether the current test item is enabled
  Log.Message(ATestItem.Enabled);
  // Obtains the test item’s StopOnError property value
  Log.Message(ATestItem.StopOnError);
  // Prints the test item’s timeout
  Log.Message(ATestItem.Timeout);
  Log.PopLogFolder();
}

Python

def Test():
  # Iterates through test items 
  for i in range (0, ProjectSuite.TestItems.ItemCount):
    LogTestItemInfo(ProjectSuite.TestItems.TestItem[i])

def LogTestItemInfo(ATestItem):
  # Prints the test item name 
  Log.AppendFolder(ATestItem.ProjectName)
  # Prints the test item description
  Log.Message(ATestItem.Description)
  # Prints the corresponding project location
  Log.Message(ATestItem.ProjectLocation)
  # Determines whether the current test item is enabled 
  Log.Message(ATestItem.Enabled)
  # Obtains the test item's StopOnError property value 
  Log.Message(ATestItem.StopOnError)
  # Prints the test item's timeout 
  Log.Message(ATestItem.Timeout)
  Log.PopLogFolder();

VBScript

Sub Test()
  Dim i
  ' Iterates through test items
  For i = 0 To ProjectSuite.TestItems.ItemCount - 1
    LogTestItemInfo(ProjectSuite.TestItems.TestItem(i))
  Next 

End Sub 

Sub LogTestItemInfo(ATestItem)
  ' Prints the test item name
  Log.AppendFolder(ATestItem.ProjectName)
  ' Prints the test item description
  Log.Message(ATestItem.Description)
  ' Prints the corresponding project location
  Log.Message(ATestItem.ProjectLocation)
  ' Determines whether the current test item is enabled
  Log.Message(ATestItem.Enabled)
  ' Obtains the test item’s StopOnError property value
  Log.Message(ATestItem.StopOnError)
  ' Prints the test item’s timeout
  Log.Message(ATestItem.Timeout)
  Log.PopLogFolder
End Sub 

DelphiScript

procedure LogTestItemInfo(ATestItem);
begin
  // Prints the test item name
  Log.AppendFolder(ATestItem.ProjectName);
  // Prints the test item description
  Log.Message(ATestItem.Description);
  // Prints the corresponding project location
  Log.Message(ATestItem.ProjectLocation);
  // Determines whether the current test item is enabled
  Log.Message(ATestItem.Enabled);
  // Obtains the test item’s StopOnError property value
  Log.Message(ATestItem.StopOnError);
  // Prints the test item’s timeout
  Log.Message(ATestItem.Timeout);
  Log.PopLogFolder();
end;

procedure Test();
var i;
begin
  // Iterates through test items
  for i := 0 to ProjectSuite.TestItems.ItemCount-1 do 
    LogTestItemInfo(ProjectSuite.TestItems.TestItem(i));
end;

C++Script, C#Script

function Test()
{
  // Iterates through test items
  for (i = 0; i< ProjectSuite["TestItems"]["ItemCount"]; i++)
  {
    LogTestItemInfo(ProjectSuite["TestItems"]["TestItem"](i));
  }
}

function LogTestItemInfo(ATestItem)
{
  // Prints the test item name
  Log["AppendFolder"](ATestItem.ProjectName);
  // Prints the test item description
  Log["Message"](ATestItem.Description);
  // Prints the corresponding project location
  Log["Message"](ATestItem.ProjectLocation);
  // Determines whether the current test item is enabled
  Log["Message"](ATestItem.Enabled);
  // Obtains the test item’s StopOnError property value
  Log["Message"](ATestItem.StopOnError);
  // Prints the test item’s timeout
  Log["Message"](ATestItem.Timeout);
  Log["PopLogFolder"]();
}

See Also

ProjectName Property (Specific to ProjectSuite Object)

Highlight search results