Problems with generated paths for mobile app

Mobile Testing, Android App Testing.
houseofcutler
Posts: 52
Joined: Fri Mar 21, 2014 4:22 pm

Problems with generated paths for mobile app

Post by houseofcutler » Tue Jun 03, 2014 4:50 pm

Hi there,

This is the first mobile application I have built tests for and before getting to far into it I would like some advice on the best way to go about the mapping of elements. Although successful I think I did more manual configuration of the paths for my web application that I should have needed to.

The the element paths used by the app I am testing change according to whether the device is IOS 6 or IOS 7. I am therefore having to go back and update some of the paths in order to make them function with both IOS versions. This in itself is fine. However...

Most of the paths that are being created by Ranorex list all of the containers and numbers as to whether they are container 1, 2 3 etc. These do not make for very robust paths and also cause me problems when I try and use // to find elements matching specific attributes later.

Here is a specific example. (Snapshot also attached)

/mobileapp[@devicename='iPhone']/container/container[2]/container[2]/container[2]/table[1]/container/container[@localizationkey='NoButton']

I have discovered that one of the differences between the IOS versions is that Ios 6 uses buttons and Ios7 uses containers. This means I need to search for //*[@localizationkey='NoButton']

The containers do not have any caption or type information. However there are details in 'IOS Element' (AccessibilityLable, Localization key) and or 'Mobile UiElement' (Platform Class).

Changing the RanorexPath generation mode - does not really make any difference to the paths.
I have checked the weight rules and set both the Container caption and type to equal 0 if they are blank. Still Ranorex generates the paths the same.

I think to make this work I need to change the paths from absolute to ones that find key elements along the way.

//container[PlatformClass='_UIModalItemRepresentationView']//*[@localizationkey='NoButton']

This will return what I want, be reasonably robust against change and cater for the different types between IOS versions.

I suppose my question is what is the best way for me to achieve this without having to manually edit the path for every element that is not always the same on both versions?

Would you recommend creating a selection of Rooted folders which I guess Ranorex would automatically add valid new elements to, or should I take a different approach?

Any advise is greatly appreciated.

Thanks

Ben
Attachments
EmergeIOSApp.rxsnp
(45.93 KiB) Downloaded 90 times

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Problems with generated paths for mobile app

Post by Support Team » Fri Jun 06, 2014 10:18 am

Hi Ben,

In some situations there is no other way than manually editing the generated RxPaths since it is not always possible for Ranorex to create the best RxPath by applying the specified rules.
In your case it means that Ranorex doesn't use the PlatformClass since it usually isn't unique and therefore has a weight of 10 as shown in the screenshot.
PlatformClass.png
PlatformClass.png (5.44 KiB) Viewed 930 times
When you know that this attribute is unique and should be automatically used by Ranorex you need to increase the weight for that attribute in the Edit RanoreXPath Weight Rules window to at least 100.

Please also take in mind that Ranorex will need more time to search for an element when the RxPath is more relative. The more relative the RxPath is, the longer will Ranorex search for the element.

May I also ask you to upload a Ranorex snapshot of the app when using iOS 6?

Regards,
Markus
.
Image

houseofcutler
Posts: 52
Joined: Fri Mar 21, 2014 4:22 pm

Re: Problems with generated paths for mobile app

Post by houseofcutler » Fri Jun 06, 2014 11:00 am

Hi Markus,

Thank you for your response. I have added an IOS6 snapshot as you requested.

I spent some time working on the Android version of this app instead yesterday and have managed to make some good progress on the mappings and organisation of the repository. This is only my second project - a web based application was my first - but I try to spend time on making sure the repository is well organised and mappings are created to allow a lot of robustness moving forward.

What I did find useful in the android app is the Android RId attributes. In IOS there are accessibility but these do not appear as much. I found with the IOS app that there were differences between the two even to the point that some elements are different types e.g. button on ios6 and container on ios7

I think rather than worrying about the excessive generic containers in the paths I will focus my efforts on identifying the main roots to create Rooter Folders with a well mapped path and then use this as the basis for adding the other elements. This has worked quite well when I worked on the android app.

Thanks
Attachments
ios6Lists.rxsnp
(91.47 KiB) Downloaded 85 times

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Problems with generated paths for mobile app

Post by Support Team » Wed Jun 11, 2014 5:08 pm

Hi Ben,

It sounds good to use a rooted folder with a robust RxPath.

Thanks for the snapshot, but the snapshot is unfortunately of a different view than the one added before. May I ask you to upload a snapshot of the same elements shown in the first snapshot?

Thanks,
Markus
.
Image