TestedApps.AddClickOnceApp Method

Applies to TestComplete 14.10, last modified on June 5, 2019

Description

The TestedApps.AddClickOnceApp method allows you to dynamically add a ClickOnce tested application to your test project.

Declaration

TestedApps.AddClickOnceApp(StartupLinkProcessToWait)

StartupLink [in]    Required    String    
ProcessToWait [in]    Required    String    
Result Integer

Applies To

The method is applied to the following object:

Parameters

The method has the following parameters:

StartupLink

A link to the ClickOnce application. It can be one of the following:

  • The URL of the ClickOnce application deployment manifest file (.application). For example, http://www.example.com/myapp/MyApp.application.

    If the application uses parameters, they should be specified in the URL query string. For example, http://www.example.com/myapp/MyApp.application?param1=value1&param2=value2.

  • The fully-qualified file name of the ClickOnce application deployment manifest (.application) on the local computer or network share. For example, C:\MyApp\MyApp.application or \\server\shared\MyApp.application.

  • The fully-qualified file name of the shortcut (.appref-ms) to the installed ClickOnce application. For example, C:\MyApp.appref-ms.

    ClickOnce .appref-ms shortcuts are typically created in the Start menu and on the desktop. However, the Start menu and desktop paths are user- and operating system-specific. If you are going to run the test on multiple computers, we recommend copying the .appref-ms shortcut to a folder that is common for all computers, for example, a network share (see Avoiding Computer-Specific Settings). Alternatively, you can specify the application by its .application manifest.

You can use environment variables in file paths. For example, %USERPROFILE%\Desktop\MyApp.appref-ms.

ProcessToWait

The application’s process name, including the extension. For example, MyApp.exe.

Result Value

A zero-based index of the ClickOnce application in the Tested Applications collection. You can use this index to access the corresponding ClickOnceTestedApp object using the TestedApps.Items(Index) property.

Example

The following script adds a ClickOnce application to TestedApps and launches it.

JavaScript, JScript

function Test()
{
  var index = TestedApps.AddClickOnceApp("http://www.example.com/myapp/MyApp.application", "MyApp.exe");
  var app = TestedApps.Items(index);
  app.WaitTimeout = 60000; // launch timeout - 1 min (60000 ms)

  app.Run();

  // Test the application
  ...

  app.Close();
}

Python

def Test():
  index = TestedApps.AddClickOnceApp("http://www.example.com/myapp/MyApp.application", "MyApp.exe")
  app = TestedApps.Items[index]
  app.WaitTimeout = 60000 # launch timeout - 1 min (60000 ms)

  app.Run()

  # Test the application
  # ...

  app.Close()

VBScript

Sub Test
  Dim index, app

  index = TestedApps.AddClickOnceApp("http://www.example.com/myapp/MyApp.application", "MyApp.exe")
  Set app = TestedApps.Items(index)
  app.WaitTimeout = 60000 ' launch timeout - 1 min (60000 ms)

  app.Run

  ' Test the application
  ...

  app.Close
End Sub

DelphiScript

procedure Test;
var index, app;
begin
  index := TestedApps.AddClickOnceApp('http://www.example.com/myapp/MyApp.application', 'MyApp.exe');
  app := TestedApps.Items(index);
  app.WaitTimeout := 60000; // launch timeout - 1 min (60000 ms)

  app.Run;

  // Test the application
  ...

  app.Close;
end;

C++Script, C#Script

function Test()
{
  var index = TestedApps["AddClickOnceApp"]("http://www.example.com/myapp/MyApp.application", "MyApp.exe");
  var app = TestedApps["Items"](index);
  app["WaitTimeout"] = 60000; // launch timeout - 1 min (60000 ms)

  app["Run"]();

  // Test the application
  ...

  app["Close"]();
}

See Also

Testing ClickOnce Applications
Adding ClickOnce Applications to Tested Applications
Run Method
StartupLink Property
ProcessToWait Property
WaitTimeout Property

Highlight search results