ClickOnceTestedApp Object

Applies to TestComplete 15.42, last modified on September 08, 2022

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 ClickOnceApp()
 {
  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.AccessToChromiumContent = true; // Enable support for ClickOnce CEF applications (by default it is disabled)
  
  app.Run();

  // Test the application
  ...

  app.Close();
 }

Python

def ClickOnceApp():
  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.AccessToChromiumContent = true # Enable support for ClickOnce CEF applications (by default it is disabled)

  app.Run()

  # Test the application
  # ...

  app.Close()

VBScript

Sub ClickOnceApp
  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.AccessToChromiumContent = true ' Enable support for ClickOnce CEF applications (by default it is disabled)

  app.Run

  ' Test the application
  ...

  app.Close
End Sub

DelphiScript

procedure ClickOnceApp;
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.AccessToChromiumContent := true; // Enable support for ClickOnce CEF applications (by default it is disabled)
  app.Run;

  // Test the application
  ...

  app.Close;
end;

C++Script, C#Script

function ClickOnceApp()
{
  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["AccessToChromiumContent"] = true; // Enable support for ClickOnce CEF applications (by default it is disabled)
  app["Run"]();

  // Test the application
  ...

  app["Close"]();
}

See Also

Testing ClickOnce Applications
About Tested Applications

Highlight search results