Test Performance based on Ranorex path

Ask general questions here.
User avatar
sandamal
Posts: 28
Joined: Wed Jul 08, 2015 7:50 am

Test Performance based on Ranorex path

Post by sandamal » Tue Nov 29, 2016 8:38 am

Hi below is an example for an automatically recorded path for plus button. this path is breaking most of the times due to other changes

Code: Select all

/form[@title='AlarmActivity']/androidelement/androidelement/androidelement[2]/container[2]/container[2]/button[@text='+']
As you know Below is an another option I can make to access the same element. (I have no conflicts with elements with same label ) which is less breakable

Code: Select all

.//*[@text='+']
So my question is If I use the second approach in many or all elements , will there be a performance hit ?
which method makes faster tests when searching for elements ?
Is using wild cards in ranorex path decreasing the speed ?

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Test Performance based on Ranorex path

Post by odklizec » Tue Nov 29, 2016 8:49 am

Hi,

Yes, your approach could have impact on test performance and Ranorex search speed. If the xpath is too short/too generic, it will have to search through all elements in your app an so it could take some time to find the element, not to mention it could find the wrong one ;) I would consider using somewhat shorter xpath, from the original one, but still specific enough to help Ranorex to find the element faster, like this:

Code: Select all

/form[@title='AlarmActivity']/androidelement//container/button[@text='+']
Additionally, from my brief experience with Android, I found that even if there is very low number of useful attributes, Android elements often have some useful info in platformclass attribute! So I would suggest to examine it in your app (via Spy) and eventually, change the xpath weight (as described here) to prioritize the platformclass attribute over other attributes. Then if your track/record an Android element, Ranorex should add platformclass to the xpath. Even after that, you may need to edit/shorten the xpath. But it could definitely make the xpath much more robust!
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration