I'm currently using page objects in my Appium and Python project to run the tests only on the iOS platform. Now I need to implement the same tests for Android (the app is the same).
I know the locators are different for each platform, but the functions I created I can use for both platforms.
In java the @iOSXCUITFindBy and @AndroidFindBy annotations make design easier for this purpose, but so far I haven't found anything similar to use with Appium and Python.
What strategy can I use to reuse the same functions for both platforms (Android and iOS)?
I used Robot Framework (python) to create test suites for testing the development of an iOS and Android app. Same app and started at the same time. Automation was done in sprint. Automated tests as the app was being developed.
Initially we created automated tests for both platforms at the same time. Similar ideas to above...If/Else etc...
We ran into issues after a few months. I wasn't as simple as If/Else. Functionality of the SAME APP across two mobile platforms changed during the development. Differences in what you can do (development/technical wise) on iOS vs Android platforms differs in some points.
They essentially were the same app but they had differences created by some technical limitations. Allot of tests were simply not applicable across both platforms and would have required allot of effort and ugly tests to shoehorn them to be.
One platform then became a priority over the other. But laying the groundwork for test functionality for both platforms has an overhead which the business didn't want/need as one platform was a priority (with option for he other to become the priority at a later date).
Dropped dual test suites after six months in favour of Android Test Suite separate to iOS Test Suite.
Sure there was some overlap but it became allot easier to manage.
If I were to start over I would have kept them separate at the start.
tldr :) Keep them separate (folder/suite structure and functionality wise).
Appium - Design page object to reuse same function with iOS and Android