ClickOnceTestedApp Object

Applies to TestComplete 14.0, last modified on January 23, 2019

Description

The ClickOnceTestedApp object corresponds to a ClickOnce application in the test project’s Tested Applications collection. It lets you get or modify the application information, such as the location of the application's deployment manifest (.application). It also provides methods to launch and close the application from tests.

To obtain the ClickOnceTestedApp object corresponding to a specific ClickOnce application, use any of the following:

  • TestedApps.AppName, where AppName is the application's name in the Tested Applications collection and in the Project Explorer.

  • TestedApps.Items(Index), where Index is the zero-based index of the application in the Tested Applications collection.

Note: A ClickOnce tested application is represented in tests as a ClickOnceTestedApp object only if the Use special runtime object option is selected for the application in the TestedApps editor. Otherwise, the application is represented by a generic TestedApp object. In this case, you can set the ClickOnce-specific parameters via the TestedApps.AppName.Params.ActiveParams object.

Members

Example

The following example adds a ClickOnce application to the Tested Applications collection and then launches and closes 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
About Tested Applications

Highlight search results