Q1.How do you design one framework for both Android and iOS?
Short answer: keep tests platform-neutral and push differences into screen objects. Tests call loginScreen.loginAs(user); an interface has Android and iOS implementations, picked from config at startup.
public interface LoginScreen { HomeScreen loginAs(User u); }
public final class Screens {
public static LoginScreen login(AppiumDriver d) {
return Platform.current() == Platform.IOS ? new IosLoginScreen(d) : new AndroidLoginScreen(d);
}
}
Shared accessibility ids across both apps remove most of the duplication - agree on them with developers early.
- When is it better to keep separate suites per platform?
