The information in this topic applies to desktop and mobile applications. To learn how to run web browsers, see Launch Web Browsers and Launching Mobile Browser Emulator. |
TestComplete lets you automatically launch your tested application during test recording and test runs. You can launch applications from the TestComplete IDE and by using the appropriate test commands.
For generic Windows applications, TestComplete supports multiple run modes - Simple, RunAs, Debug and Profile. TestComplete launches these applications in the mode specified in the TestedApps editor or in your tests.
Running Applications From the TestComplete IDE
Running Applications During Test Recording
Running Applications From Keyword Tests
Running Applications From Scripts
Running Applications From the TestComplete IDE
To run your tested application:
-
Right-click the application in the Project Explorer and select Run from the context menu.
-
Right-click the application in the TestedApps editor and select Run from the context menu.
To run all the tested applications:
-
Right-click the TestedApps node in the Project Explorer and select Run All from the context menu.
-
Right-click somewhere in the TestedApps editor and select Run All from the context menu.
Running Applications During Test Recording
To launch your tested application during test recording, select it from the application list on the Recording toolbar.
You can also configure TestComplete to automatically launch all or specific tested applications every time you start test recording. To do this:
-
Open the TestedApps editor.
-
Select an application in the list and then select the Autorun application on recording check box in the application parameters.
Note: | This option is not currently supported for iOS applications. |
If your application is not in the TestedApps editor, you can launch it in a usual way (for example, by using a desktop shortcut or via the Start menu), and TestComplete will automatically add it to the TestedApps editor.
In any case, TestComplete will add the application launch operation to your recorded test.
Running Applications From Keyword Tests
In keyword tests, use the Run TestedApp operation to launch your tested application. You typically add this operation at the beginning of your tests.
To run several instances of the application, specify the number of instances in the operation’s Count parameter.
Running Applications From Scripts
To run a tested application, call the TestedApp.Run
method:
JavaScript, JScript
TestedApps.AppName.Run();
Python
TestedApps.AppName.Run()
VBScript
TestedApps.AppName.Run
DelphiScript
TestedApps.AppName.Run;
C++Script, C#Script
TestedApps["AppName"]["Run"]();
If your tested application is a desktop application, you can run several instances of it:
JavaScript, JScript
TestedApps.notepad.Run(2);
Python
TestedApps.notepad.Run(2)
VBScript
Call TestedApps.notepad.Run(2)
DelphiScript
TestedApps.notepad.Run(2);
C++Script, C#Script
TestedApps["notepad"]["Run"](2);
You can also run your desktop tested application by calling the DbgServices.LaunchTestedApplication
or DbgServices.LaunchAllTestedApplications
method. These methods start the application and command TestComplete to act as a debugger for the application process. TestComplete will trace and report events (with call stack) and debug strings that occur during the application run.
If you have several tested applications in the Tested Applications collection, you can run all of them by calling the TestedApps.RunAll
method:
JavaScript, JScript
TestedApps.RunAll();
Python
TestedApps.RunAll()
VBScript
TestedApps.RunAll
DelphiScript
TestedApps.RunAll;
C++Script, C#Script
TestedApps["RunAll"]();
Running Applications Under Another Account
To run your tested application under a different user account, you can use the TestedApps.AppName.RunAs
method:
JavaScript, JScript
TestedApps.notepad.RunAs("DOMAIN", "user", "password");
Python
TestedApps.notepad.RunAs("DOMAIN", "user", "password")
VBScript
Call TestedApps.notepad.RunAs("DOMAIN", "user", "password")
DelphiScript
TestedApps.notepad.RunAs('DOMAIN', 'user', 'password');
C++Script, C#Script
TestedApps["notepad"]["RunAs"]("DOMAIN", "user", "password");
In keyword tests, you can call the RunAs
method using the Call Object Method or Run Code Snippet operation.
Another way is to select the RunAs mode for your application and specify the needed user account in the TestedApps editor. In this case, if you run the application from the TestedApps editor, it will be launched under the specified account.
For more information, see Testing Applications Running Under Another User Account.
Notes
-
TestComplete will not launch an application if the Launch application from tests check box is clear for the application in the TestedApps editor.
-
To use the RunAs or Profile mode, you must run TestComplete as an administrator. See Using TestComplete With Administrator Privileges.
-
For the specifics of running mobile applications, see the following topics:
-
In rare cases, your application may hang if you run it from the TestedApps editor. In this case, you can do one of the following:
-
Create a batch file (.bat) that runs your application and add this file to the TestedApps editor instead of your application. For example:
MyApp.bat
start "" "C:\Program Files\My App\My App.exe"
-
Run your application without using the TestedApps editor. For example, you can use the
WshShell
scripting object instead:JavaScript, JScript
WshShell.Run("notepad");
Python
WshShell.Run("notepad")
VBScript
Call WshShell.Run("notepad")
DelphiScript
WshShell.Run('notepad');
C++Script, C#Script
WshShell["Run"]("notepad");
-
See Also
About Tested Applications
Working With Tested Applications in Tests
Keyword Tests
Starting Tested Android Applications
Starting Tested iOS Applications