Appium on iOS and Android


I am using Cucumber with Appium. I have a project where the application is on both Android and iOS. Both applications share the same flow and features, so I am torn on what is the best practice to implement one feature file with step definition that can handle both iOS and Android.

I have read other forums where people suggested to use separate feature files (which I’m against). Or a single feature file with separate step definition that can be specified in the TestRunner class on which step definition we should use.

Hi again,

After revisiting this issue. I will be using a parameter that indicates if the device is an iOS or Android product and in the functions I will be passing this parameter with an:

if (parameter.equals("iOS"){
// implement the locators and actions compatible with iOS
}else {
// implement the Android Locators and Actions

Please continue this thread with more suggestions or implementations you have previously used.

Thank you!

If you are with Java use appium annotations.

iOSFindBy(id = "some id")
AndroidFindBy(id = "some id")
MobileElement someButton;

Thank you @Aleksei,

I will look more into the PageObject approach where we use such annotations. Is there a best practice blog or documentation on how to implement and handle such elements?

Best Regards

Some tests are mentioned here

1 Like