Windows Vista, Windows 7, Windows Server 2008 and later Windows versions provide a new security level, which is higher than that in previous versions of Windows. In order for TestComplete to be able to test applications on these Windows versions, TestComplete must have the same or higher privileges than the applications under test has. However, some changes in the security model may cause the test engine to malfunction:
Even if you log in to Windows using an administrator account, the applications that you will execute will not necessarily have administrator rights.
When TestComplete is launched from a user account, it will not have access to some application processes, since administrator privileges are required for this.
Even if TestComplete and your tested application are running under the same user account, they may have different security permissions under Windows 7, Windows Server 2008 R2 or later Windows versions. TestComplete can only “see” and interact with an application if it has the same or a higher level of security permissions than the application. For example, if TestComplete is run with user permissions and a tested application is run with administrator permissions, TestComplete will not be able to see the application’s windows and controls and to obtain properties of the application’s process.
To test your application, TestComplete must have the same or higher privileges than the application you are testing has:
If the tested application has user privileges, TestComplete can have either user or administrator privileges.
If the tested application has administrator privileges, TestComplete must also have administrator privileges.
The next sections explain how you can launch applications with administrator permissions in Windows.
There are several ways to run TestComplete as an administrator:
Right-click the TestComplete shortcut and select Run as administrator from the context menu:
Modify the TestComplete shortcut properties to run it as an administrator:
Right-click the shortcut and select Properties from the context menu.
On the Shortcut tabbed page, click the Advanced button. The Advanced Properties dialog will appear.
Select the Run as administrator check box and click OK.
Close the shortcut properties.
Now, every time you run TestComplete using this shortcut, you will run it as an administrator.
Modify the TestComplete.exe file properties to always run it as an administrator:
Locate the TestComplete.exe file in Windows Explorer or other file manager:
Right-click the file and select Properties from the context menu.
Switch to the Compatibility tabbed page.
Select the Run this program as an administrator check box and click OK.
Now every time time you run TestComplete – whether via a shortcut, from command line or any other way – it will be run as administrator.
When launched with the Compatibility > Run this program as an administrator option, TestComplete cannot recognize Edge as a web browser. If you need to test websites in Edge while running TestComplete as administrator, launch TestComplete using one of the other methods described above.
When you run an application with administrator privileges under Windows 7, Windows Server 2008 R2 or later Windows versions, Windows displays a dialog box asking for your permission for the run. Due to certain limitations, the closing of this dialog box cannot be automated: when this dialog box is visible, the script run is automatically paused. So, you should close the dialog box manually or modify User Account Control settings so that Windows does not display the dialog. Note, however, that modifying the settings will impair the security:
Open Control Panel by clicking Start and then clicking Control Panel.
In the search box, type User Accounts and then select the User Accounts applet.
In the User Accounts window, click Turn User Account Control on or off.
Windows will display a dialog box asking for your permission to continue. Click Continue in the dialog.
Clear the Use User Account Control (UAC) to help protect your computer check box and press OK.
Close the User Accounts window.
Restart your computer.
From now on, Windows will not display confirmation dialogs when you launch an application with administrator privileges. Note once again that changing the settings in the described way will impair the security.
You can launch a tested application with administrator permissions in the same manner that was described in the previous section. Note, however, that when a tested application is launched from TestComplete, the application will automatically gain the same privilege level as TestComplete. So if you call the tested application from the context menu of the TestedApps project item or by calling the
TestedApp.Run method in your script or the Run Tested App operation in your keyword tests, you do not need to modify the application’s properties.
Using some of the testing features requires that TestComplete have administrator permissions:
Running the tested application in the RunAs mode, that is, under another user account. See Testing Applications Running Under Another User Account.
Running the tested application in the Profile mode, that is, under a profiler.
Changing the system date and time using the
Shutting down or restarting the computer as a part of the test run. See Shutting Down and Restarting Computer After Test Run and Rebooting the Computer During Automated Testing.
TestComplete 32-bit executable is located in the <TestComplete>\Bin folder.
TestComplete 64-bit executable is located in the <TestComplete>\x64\Bin folder.