Executing QTP Scripts on a Remote Computer
By default when you can able execute QTP scripts on a Local Machine. Automation Object Model is providing a facility to execute QTP scripts on a Remote Machine.
When you use CreateObject("QuickTest.Application"), it is giving permissions to execute scripts in local machine’s QTP.
To execute scripts in Remote Machine use
Set qtApp = CreateObject("QuickTest.Application", "Remote Machine Name")
Before using this statement ensure that the Distributed COM (DCOM) Configuration Properties of the remote computer are set to allow you to run QuickTest Professional Automation from your computer.
Steps to Set the DCOM Configuration Properties on Remote Machine
- On the computer where you want to run the automation script, choose
Start--> Run. The Run dialog box opens.
- Enter DCOMCNFG and click OK. The Distributed COM Configuration Properties dialog box or the Component Services window opens (depending on your operating system) and displays the list of COM applications available on the computer.
- Select QuickTest Professional Automation from the list and open the Properties dialog box for the application. (Click the Properties button or right-click and choose Properties, depending on your operating system.)
- In the QuickTest Professional Automation Properties dialog box, click the Security tab.
- In the launch permissions section, choose the custom option and click Edit.
- Use the Add and Remove options to select the network users or groups for which you want to allow or deny permission to launch QuickTest Professional via an automation script. When you are finished, click OK to save your settings.
- Repeat steps 5 and 6 for the configuration permissions section to select the users or groups who can modify QuickTest Professional configuration options via an automation script.
- In the QuickTest Professional Automation Properties dialog box, click the Identity tab and select the interactive user option.
- Click OK to save the QuickTest Professional Automation Properties settings.
- Click OK to close the Distributed COM Configuration Properties dialog box or the Component Services window.
If we get below error
""Microsoft VBScript runtime error: Permission denied: 'CreateObject'""
follow below steps to get rid of Permission denied error.
Part I:
Add both machines into the same domain. For the domain users logged into both machines, add these domain users to the Local Administrators group on the QTP machine. This is required for Windows to authenticate the remote user executing the tests against the DCOM objects.
Part II:
On the Testing Tool client machine configure Windows Firewall to allow Port 135 for DCOM:
1. Select Start -> Control Panel -> Windows Firewall.
2. Navigate to the Exceptions tab.
3. Configure the Remote Agent to be allowed under "Programs and Services." Configuration should be done for QTP as given below:
QuickTest Professional Remote Agent (path: :\Program Files\Mercury Interactive\QuickTest Professional\bin\AQTRmtAgent.exe)
4. Click on and add the DCOM TCP port 135 to the Exceptions list. The list of "Port Assignments for Commonly-Used Services" is provided in the URL below:
Part III: (NOT ALL STEPS HAVE BEEN COMPLETED, SOME EXTRA USERS)
Modify DCOM Security Properties:
1. Select Start -> Run and enter dcomcnfg.
2. Navigate to Console Root -> Component Services -> Computers -> My Computer.
Note: If Windows Security Alert dialog window appears, click on or .
3. Right-click on My Computers and select "Properties."
4. Navigate to the Default Properties tab.
5. Make sure the Default Impersonation Level is "Identify."
6. Click .
7. Navigate to the Defualt COM Security tab.
8. Under Access Permissions, click on . The Access Permission dialog window appears.
9. Click on . The Select Users or Groups dialog windows appear.
10. Click on .
11. Click on .
12. Add the following groups and users from the local machine
Administrator
Administrators
Authenticated User
Anonymous Logon
Everyone
Interactive
Network
System
13. Click .
14. Add the following groups and users from the domain:
15. Click .
16. Give "Local Access" and "Remote Access" permissions to the groups and users.
17. Click .
18. Under Access Permissions, repeat steps 9-17 for .
19. Under Launch and Activation Permissions, click on . The Launch Permission dialog window appears.
20. Repeat steps 9-15.
21. Enable "Local Launch," "Remote Launch," "Local Activation," and "Remote Activation" permissions to the groups and users.
22. Click .
23. Repeat steps 20-22 for .
Part IV: (for QTP only)
1. While still in the Component Services window, navigate to Console Root -> Component Services -> Computers -> My Computer -> DCOM Config.
2. Look for the following.
AQTRmtAgent
QuickTest Professional Automation
TlpRmtServer
3. For each of these DCOM applications, right click and select .
4. Under the Identity tab, select . This will allow the DCOM application to authenticate the process against the logged in Windows user and run the process in that security context.
5. Next, go to the Security tab.
6. For both the and , select . This will use the Default security settings as we did in Part III.
7. Click Apply, then OK to commit the changes.
Part I:
Add both machines into the same domain. For the domain users logged into both machines, add these domain users to the Local Administrators group on the QTP machine. This is required for Windows to authenticate the remote user executing the tests against the DCOM objects.
Part II:
On the Testing Tool client machine configure Windows Firewall to allow Port 135 for DCOM:
1. Select Start -> Control Panel -> Windows Firewall.
2. Navigate to the Exceptions tab.
3. Configure the Remote Agent to be allowed under "Programs and Services." Configuration should be done for QTP as given below:
QuickTest Professional Remote Agent (path: :\Program Files\Mercury Interactive\QuickTest Professional\bin\AQTRmtAgent.exe)
4. Click on and add the DCOM TCP port 135 to the Exceptions list. The list of "Port Assignments for Commonly-Used Services" is provided in the URL below:
Part III: (NOT ALL STEPS HAVE BEEN COMPLETED, SOME EXTRA USERS)
Modify DCOM Security Properties:
1. Select Start -> Run and enter dcomcnfg.
2. Navigate to Console Root -> Component Services -> Computers -> My Computer.
Note: If Windows Security Alert dialog window appears, click on or .
3. Right-click on My Computers and select "Properties."
4. Navigate to the Default Properties tab.
5. Make sure the Default Impersonation Level is "Identify."
6. Click .
7. Navigate to the Defualt COM Security tab.
8. Under Access Permissions, click on . The Access Permission dialog window appears.
9. Click on . The Select Users or Groups dialog windows appear.
10. Click on .
11. Click on .
12. Add the following groups and users from the local machine
Administrator
Administrators
Authenticated User
Anonymous Logon
Everyone
Interactive
Network
System
13. Click .
14. Add the following groups and users from the domain:
15. Click .
16. Give "Local Access" and "Remote Access" permissions to the groups and users.
17. Click .
18. Under Access Permissions, repeat steps 9-17 for .
19. Under Launch and Activation Permissions, click on . The Launch Permission dialog window appears.
20. Repeat steps 9-15.
21. Enable "Local Launch," "Remote Launch," "Local Activation," and "Remote Activation" permissions to the groups and users.
22. Click .
23. Repeat steps 20-22 for .
Part IV: (for QTP only)
1. While still in the Component Services window, navigate to Console Root -> Component Services -> Computers -> My Computer -> DCOM Config.
2. Look for the following.
AQTRmtAgent
QuickTest Professional Automation
TlpRmtServer
3. For each of these DCOM applications, right click and select .
4. Under the Identity tab, select . This will allow the DCOM application to authenticate the process against the logged in Windows user and run the process in that security context.
5. Next, go to the Security tab.
6. For both the and , select . This will use the Default security settings as we did in Part III.
7. Click Apply, then OK to commit the changes.
No comments:
Post a Comment
Note: only a member of this blog may post a comment.