Working With Tested Applications in Tests

Applies to TestComplete 15.70, last modified on December 17, 2024

This topic describes how you can work with applications in the Tested Applications collection from tests.

Note: Working with BitBar applications added to the Tested Applications collection, from tests, is not supported.

Accessing Tested Applications from Tests

You can access the list of tested application in your current project from tests by using the TestedApps object. The object has methods and properties you use to manage applications in the list.

To work with individual tested applications, you use the following objects (depending on the tested application type):

You can get these objects by using the TestedApps.Item property. Alternatively, you can use the TestedApps.MyTestedAppItemName statement, where MyTestedAppItemName is the name of the tested application in the Tested Applications collection.

JavaScript, JScript

var MyApp;
 
// The following lines are equivalent
 MyApp = TestedApps.MyTestedApp;
MyApp = TestedApps.Items("MyTestedApp"); // Get application by name
MyApp = TestedApps.Items(0); // Get application by index

Python

# The following lines are equivalent
MyApp = TestedApps.MyTestedApp
MyApp = TestedApps.Items["MyTestedApp"] # Get application by name
MyApp = TestedApps.Items[0] # Get application by index

VBScript

Dim MyApp
 
' The following lines are equivalent
Set MyApp = TestedApps.MyTestedApp
Set MyApp = TestedApps.Items("MyTestedApp") ' Get application by name
Set MyApp = TestedApps.Items(0) ' Get application by index

DelphiScript

var
  MyApp : OleVariant;
begin
  // The following lines are equivalent
  MyApp := TestedApps.MyTestedApp;
  MyApp := TestedApps.Items['MyTestedApp']; // Get application by name
  MyApp := TestedApps.Items[0]; // Get application by index
end;

C++Script, C#Script

var MyApp;
 
// The following lines are equivalent
MyApp = TestedApps["MyTestedApp"];
MyApp = TestedApps["Items"]("MyTestedApp"); // Get application by name
MyApp = TestedApps["Items"](0); // Get application by index

Anything you do with your tested applications via the TestComplete user interface you can do by using those scripting objects.

To work with tested applications from keyword tests, call the needed methods and properties of appropriate objects by using the Call Object Method, Run Code Snippet and Run Script Routine operations.

Running Tested Application From Tests

To learn how to run tested applications from TestComplete, see:

Running Tested Applications

Closing Tested Applications From Tests

To learn how to close tested applications launched from TestComplete, see:

Closing Tested Applications

Modifying Run Parameters From Tests

TestComplete launches tested applications according to parameters set in the TestedApps editor.

You can access launch parameters of a tested application by using an appropriate object.

To learn how to set launch parameters of tested applications from tests, see the following topics:

See Also

About Tested Applications
Running Tested Applications
Editing Desktop Application Parameters
Editing Web Application Parameters
Editing Desktop Application Parameters
Passing Command-Line Arguments to Tested Applications

Highlight search results