Page tree
Skip to end of metadata
Go to start of metadata

Last updated: May 31, 2020 13:20

By Philipp Schwarze

If you have existing UFT Web tests (that were ideally even recorded with a User Agent Switcher), then this approach can be the base to enabling them to be run against Perfecto devices in your Continuous Quality Lab.
The sample uses a function library that "translates" the existing actions on the fly by intercepting the calls to run them against specified Perfecto devices.

This function library is an example of how we can use RegisterUserFunc to override UFT's standard click and set methods on UFT Web objects, in order to run these UFT Web tests on Perfecto devices.

The idea behind this is to use the Web Addin to identify objects within UFT (obtaining a unique identification), to then trigger the wanted action against the mobile browser. In order to ensure that a unique ID exists to be used with Perfecto, the example instruments the opened Webpage temporarily adding Perfecto IDs to the objects on the webpage.

Requirements are:

    • Unified Functional Testing 12.52 (may also work with earlier versions) with Web and UFT Mobile Add-In enabled
    • Installed UFT Add-In Perfecto Lab for UFT (see here)
    • Installed Mozilla Firefox with HP Functional Testing Agent Add-on enabled
    • Access to devices within a Perfecto Lab with automation permission (credentials need to be configured in UFT Mobile under Tools->Options->UFT Mobile->Cloud Auto-Login)

To use the function library, open it in your test and associate it to it.

Below you will find both the function library- Browser_Mobile_sync.qfl, as well as an example UFT test which you just need to open and run.

Browser_Mobile_sync.qfl

More in detail, what happens when the function library is associated, is that Click, Set and Navigate methods for a number of objects are overridden.

Browser.Navigate will actually navigate to the page on the device.

Element.Click and Set will now first add an attribute (perfecto_name) to each of the objects on the page. 
The Html will then be downloaded to the UFT client.
Now Firefox will navigate to the local page, and identify the object using UFT identification properties.
Once the object is identified, a unique XPath is created using the perfecto_name property.
This XPath is then used to initiate the Click or Set event on the remote device.

Currently only Click, Set and Navigate Actions are included for Link, WebElement, WebButton, WebEdit.

Example UFT test