DbgServices.LaunchAllTestedApplications Method

Applies to TestComplete 15.45, last modified on December 01, 2022

Description

The DbgServices.LaunchAllTestedApplications method launches all the applications listed in the TestedApps project item. The DbgServices object traces all relevant events in each application and posts them to the test log as they occur.

Declaration

DbgServices.LaunchAllTestedApplications()

Result None

Applies To

The method is applied to the following object:

Result Value

None.

Remarks

The method launches tested applications according to their run modes. If the tested application’s run mode is set to Simple or Debug, the method launches the application and then assigns debugging permissions to the TestComplete process to allow it to trace the application’s events.

If RunAs mode is active, the method performs similar actions, but launches the application under the user account that is specified by the application properties.

If run mode is set to Profile, the method does not launch an application and posts an error message to the test log.

The method also checks the Launch and Count properties for the tested applications:

  • If the Launch property is False, the application is not launched.
  • The Count property specifies the maximum number of application instances that can run in the system. The LaunchAllTestedApplications method uses it in the same way as the TestedApp.Run method. Suppose, the Count property holds 7 meaning that TestComplete can run a maximum of 7 instances of your tested application. Suppose also, that 5 instances are already running. If you call the LaunchAllTestedApplications method, TestComplete will only run 2 new instances of the tested application (2 + 5 = 7).

    The DbgServices engine will trace the execution of only these 2 application instances, it will not attach to the running instances.

To work from script with the list of tested applications defined in the current project, use the TestedApps object.

Note: When launching an application, the operating system displays a dialog box asking for your permission to run it. Due to certain limitations, the closing of this dialog box cannot be automated. You should close it manually, or modify User Account Control settings so that Windows does not display the dialog. See Using TestComplete With Administrator Privileges.

Example

The code below launches all the tested applications by using the DbgServices.LaunchAllTestedApplications method.

JavaScript, JScript

function LaunchAllTestedApps()
{
  // Launches all the tested applications and
  // obtains the total number of the tested applications
  DbgServices.LaunchAllTestedApplications;
  var TestedAppsNum = TestedApps.Count;
  
  // Iterates through the records
  for (var i = 0; i < TestedAppsNum; i++)
  {
    // Obtains a tested application
    var Item = TestedApps.Items(i);
    // Posts the application's name to the test log
    Log.Message("The name of the " + (i+1) + " tested application is " + Item.ItemName);
  }
  
  // ...

}

Python

def LaunchAllTestedApps():
  # Launches all the tested applications and
  # obtains the total number of the tested applications
  DbgServices.LaunchAllTestedApplications
  TestedAppsNum = TestedApps.Count
  # Iterates through the records
  for i in range(0, TestedAppsNum):
    # Obtains a tested application
    Item = TestedApps.Items[i]
    # Posts the application's name to the test log
    Log.Message("The name of the " + str(i+1) + " tested application is " + Item.ItemName)
  # ...

VBScript

Sub LaunchAllTestedApps

  ' Launches all the tested applications and
  ' obtains the total number of the tested applications
  DbgServices.LaunchAllTestedApplications
  TestedAppsNum = TestedApps.Count
  
  ' Iterates through the records
  For i = 0 to (TestedAppsNum - 1)
    ' Obtains a tested application
    Set Item = TestedApps.Items(i)
    ' Posts the application's name to the test log
    Log.Message("The name of the " & (i+1) & " tested application is " & Item.ItemName)
  Next
  
  ' ...

End Sub

DelphiScript

function LaunchAllTestedApps;
var TestedAppsNum, i, Item;
begin

  // Launches all the tested applications and
  // obtains the total number of the tested applications
  DbgServices.LaunchAllTestedApplications;
  TestedAppsNum := TestedApps.Count;
  
  // Iterates through the records
  for i := 0 to (TestedAppsNum - 1) do
  begin
    // Obtains a tested application
    Item := TestedApps.Items[i];
    // Posts the application's name to the test log
    Log.Message('The name of the ' + (i+1) + ' tested application is ' + Item.ItemName);
  end;
  
  // ...

end;

C++Script, C#Script

function LaunchAllTestedApps()
{
  // Launches all the tested applications and
  // obtains the total number of the tested applications
  DbgServices["LaunchAllTestedApplications"];
  var TestedAppsNum = TestedApps["Count"];
  
  // Iterates through the records
  for (var i = 0; i < TestedAppsNum; i++)
  {
    // Obtains a tested application
    var Item = TestedApps["Items"](i);
    // Posts the application's name to the test log
    Log["Message"]( "The name of the " + (i+1) + " tested application is " + Item["ItemName"] );
  }
  
  // ...

}

See Also

LaunchTestedApplication Method
LaunchApplication Method
AttachToProcess Method
Run Method
RunAll Method
Run Modes and Parameters

Highlight search results