Locators and Test cases with multiple devices

I really have been trying my best to find good information about this topic everywhere and I’m still struggling to choose what is the best methods to add locators and test cases for both Android and iOS -devices, when I have same application (developed separately) and I want to apply same test framework for them. For the locators I have own file that stores them as variables.

  1. How should I store same elements with different locators for the devices? Same test cases would work if I just use different locators for the devices. Should I make two different variable files or should I use some kind of ‘or’ -method that tries to find both of them and uses the one test finds? for ex. ‘xpath=//*[@resource-id=’${PACKAGE}:id/input_editfield’ or @name=“TA_UserIdField”]’’.

  2. Should I use same test cases for both devices? It should work with most of the cases because applications are pretty much the same. It just needs different locators as mentioned before. Or should both devices have their own test cases? Does it affect the answer if I would want to run tests for bot devices at the same time?

Thank you. I’m pretty new with this framework :slight_smile:

1 Like