Cross-platform testing
UFT One tests can use the same scripts to test multiple applications, on multiple devices and platforms.
Test multiple devices
Use the Record and Run settings, object properties, and descriptive programming to record and run on multiple applications and devices.
For example, the following script shows a single test.
This test uses Web methods as well as Mobile methods to perform steps on a mobile device, and then moves on to select list items on a second mobile device.
Browser("Google ").Page("Google").WebEdit("Search").Set "hp"Browser("Google ").Page("Google").Link("HP Support and Drivers").Click
Device("Device").App("Mobile Browser").MobileEdit("url").SetFocus
Device("Device").App("Mobile Browser").MobileEdit("url").Set "http://www.bing.com"
Device("Device_2").App("UICatalog").MobileList("list").Select 5
Device("Device_2").App("UICatalog").MobileList("listview_1").Select 0
For more details, see:
- Define Mobile Record and Run Settings
- Maintain test objects in object repositories
- Programming Tests
Test multiple platforms
Record a test using one mobile operating system, and then run the test on another.
Adjust the App test object properties when switching back and forth between Android and iOS.
Tip: The following examples show App test object properties for the Digital Lab Browser (UFTM Browser) app. Replace the values as needed when using a native browser.
iOS | "identifier:=com.hp.HPMobileWebBrowserINJ" "name:=HPE Mobile Web"
|
Android | "identifier:=com.hp.mobileweb" "name:=HPE Mobile Web"
|
Adjust these properties by:
-
Manually changing the values in the object repository
-
Parameterizing the properties in the object repository
-
Using the App.SetTOProperty method
For more details, see the App test object in the UFT One Object Model Reference.
Test Web on mobile
Record your Web tests on a desktop browser, and then run them on a mobile browser using the Mobile Web app.
To do this, you must have both the Mobile and Web Add-ins loaded.
Alternatively, consider using the Chrome emulator to record and run tests on Web apps. The Chrome emulator enables you to run the same test on both desktop and mobile browsers, as well as test devices not yet supported by UFT One.
For more details, see Define settings to test Web apps using the Chrome emulator.
Note: The Mobile Web app supports replaying web tests only.
Prepare for BPT testing on multiple devices
Application area settings are limited to a single device and application. To test multiple devices or applications simultaneously, do the following:
-
Create an object repository parameter for the Device and/or the App test object's id or identifier description property.
For details, see:
-
Associate the parameter with your component, business process test, or flow test parameter.
-
Change the value of that parameter to represent a different device or app ID for each test iteration, as needed.
Tip: Alternatively, insert an App.Launch statement as a component step to launch your mobile application.
For details, see the Mobile section of the UFT One Object Model Reference for GUI Testing.
Use a description property to identify your device
Create a device id property that is used in the server's script or settings to identify the correct device to open.
Do the following:
- Open your test in UFT One.
-
Add the id description property to the Device test object.
-
Add a device_id test input parameter.
For more details, see Use action and test parameters.
-
Add a device_id action input parameter.
Do the following:
- In the Solution Explorer, select the relevant action node.
- In the Properties pane, click the Parameters tab .
- Click the Add down arrow, and select Add Input Parameter.
-
In the Add Input Parameter dialog box, name the parameter as device_id or similar.
The parameter is added at the action level.
-
Create a link between the test and action input parameters.
Do the following:
- In the canvas, right-click the action containing the action input parameter and select Action Call Properties to open the Action Call Properties dialog box.
- On the Parameter Values tab, click the Default Value cell for the device_id parameter, and then click the Configuration button.
-
In the Value Configuration Options dialog box, select Parameter.
Under the Parameter option, verify that Test/action parameter and device_id are selected.
The default value for device_id is set in the Action Call Properties dialog box.
-
Click OK and return to the canvas, where a link is added between the test and action input parameters.
-
Configure the Device test object's id description property to use the device_id parameter.
Do the following:
- In the test's object repository tree, select the Device test object.
- In the Test object details area, click the Configuration button for the id description property.
-
In the Value Configuration Options dialog box, select Parameter > Test/action parameter.
In the Parameter box, select device_id.
In the object repository, the value for the id description property is set to device_id.
Use a description property to identify your application
Create an application identification property that is used in the server's script or settings to identify the correct application to open when the test is run.
- Open your test in UFT One.
-
Add an app_name test input parameter.
Do the following:
- In the Solution Explorer, select the test node.
- In the Properties pane, click the Parameters tab .
- Click the Add down arrow, and select Add Input Parameter.
-
In the Add Input Parameter dialog box, name the parameter as app_name or similar.
The parameter is added at the test level.
-
Add an app_name action input parameter.
Do the following:
- In the Solution Explorer, select the relevant action node.
- In the Properties pane, click the Parameters tab .
- Click the Add down arrow, and select Add Input Parameter.
-
In the Add Input Parameter dialog box, name the parameter as app_name or similar.
The parameter is added at the action level.
-
Create a link between the test and action input parameters.
Do the following:
- In the canvas, right-click the action containing the action input parameter and select Action Call Properties to open the Action Call Properties dialog box.
- On the Parameter Values tab, click the Default Value cell for the app_name parameter, and then click the Configuration button.
-
In the Value Configuration Options dialog box, select Parameter.
Under the Parameter option, verify that Test/action parameter and app_name are selected.
The default value for app_name is set in the Action Call Properties dialog box.
-
Click OK and return to the canvas, where a link is added between the test and action input parameters.
-
Configure the App test object's identifier description property to use the app_name parameter.
Do the following:
- In the test's object repository tree, select the App test object.
- In the Test object details area, click the Configuration button for the name description property.
-
In the Value Configuration Options dialog box, select Parameter > Test/action parameter.
In the Parameter box, select app_name.
In the object repository, the value for the name description property is set to app_name.
See also:
- How to perform Cross Browser Testing with Mobile browsers in UFT
- One Script to Rule them all – Testing Android and iOS Hybrid Apps with Micro Focus UFT
- Run a single test across multiple operating systems
- Test Web apps on multiple browsers
- Define Mobile Record and Run Settings
- Use descriptive programming for multiple browser testing - Use-case scenario