Page 1 of 1

Test Performance based on Ranorex path

Posted: Tue Nov 29, 2016 8:38 am
by sandamal
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 ?

Re: Test Performance based on Ranorex path

Posted: Tue Nov 29, 2016 8:49 am
by odklizec
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!