Sunday, April 20, 2014

UFT / QTP - Run tests on a Safari browser on a remote Mac

UFT / QTP - Run tests on a Safari browser on a remote Mac

You can now use UFT 12′s new functionality to run QTP / UFT script on a Remote Mac in Safari browser. At the moment you can only run Web based test objects with this feature.

For this you need to install the UFTConnectionAgent (Unified Functional Testing/MSI/HP/Unified Functional Testing/Installation/Safari) on your Mac machine.

Screenshot-1


When you double click on the above UFTConnectinAgent.dmg file you will get below pkg. Just double click on this HP UFT Connection Agent.pkg to install the UFTConnectionAgent.

Screenshot-2


Below are the screenshots of UFT Connection Agent installation on Mac:

Screenshot-3 (Starting installation)


Screenshot-4


Screenshot-5


Screenshot-6 (Installation completed successfully)


Now when you go to Apple (Menu) -> System Preferences, you will see the HP UFT Connection Agent icon as below:

Screenshot-7


A small background:
Earlier I had Mac OSX 10.7.3 on which I Installed “HP UFT Connection Agent”. It installed completely fine without any error. When I went to System Preferences and launched HP UFT Connection Agent it showed the error “You can’t open HP UFT Connection Agent preferences because it doesn’t work on an Intel-based Mac.”.

I updated my Mac OSX to 10.9.2. I then went to System Preferences and again tried launching HP UFT Connection Agent and this time it launched fine.

But the problems did not end here. The agent was not running and HP UFT Connection Agent dialog showed text in red that “Agent not running”.

Screenshot-8 (Agent not running)


So I uninstalled the HP UFT Connection Agent and reinstalled it on Mac. After that it worked perfectly fine and in the HP UFT Connection Agent dialog it now showed the text “Agent running” with a green tick.

Screenshot-9 (Agent running)


Note: So make sure you fulfil the requirements of Mac OSX 10.8 / Safari 6.0 / higher or Mac 10.9 with Safari 7.0 / higher etc. before you try this new feature.

Then I went to my Windows machine, launched UFT 12 and opened a new test.

Click on Remote Connection button in toolbar.
Enter your Mac’s Hostname or IP address.
I was able to use both.

Screenshot-10 (Connection with IP Address)


Screenshot-11 (Connection with Hostname)


Look at the screenshots Screenshot-9, Screenshot-10 and Screenshot-11 carefully and then try to connect.

Recorded the below script in the new UFT Test. (this script launches IE, opens Google and searches ‘qtp’).
Systemutil.Run"C:\Program Files\Internet Explorer\IExplore.exe"
Browser("Browser").Page("Page").Sync
Browser("Browser").Navigate "http://google.com/"
Browser("Browser").Page("Google").WebEdit("q").Set "qtp"
Browser("Browser").Page("Google").WebEdit("q").Submit
Browser("Browser").Page("qtp - Google Search").Sync
Browser("Browser").Close

Make sure Safari browser is open on Mac.
Now when you run this script by clicking the Run button in UFT (on Windows), you will see the magic happening.

This script runs simultaneously on IE (on Windows) and Safari (On Mac).

So in a nutshell:
1. Install HP UFT Connection Agent on Mac.
2. In QTP / UFT, Open Remote Connection dialog (Ctrl+T).
3. Make sure both Remote Connection dialog (on Windows) and HP UFT Connection Agent (on Mac) are talking to each other (are green).
4. Run test script.