A mobile test automation framework that passes sequentially and collapses under parallel execution isn't flaky. It's single-threaded by construction โ one driver instance, screen objects holding element proxies bound to that driver, every thread targeting the same device and the same automation port.
That's an architectural problem, not a matter of tuning waits.
I spent the last few months building one in Java and writing up each step. Nine parts, one codebase, starting from an empty directory:
๐๏ธ The architecture principles behind every later decision โ SRP, OCP, DIP, and what "robust" actually means
๐ฆ Maven multi-module layout โ and when a single module is the better call
๐ DriverManager owning the Appium session, BasePage wiring PageFactory
๐ฅ Cucumber and Spring โ feature files, step definitions, CucumberSpringConfiguration
๐ฑ One screen object class driving both Android and iOS
โ๏ธ Spring profiles for platform, device, environment and test phase
๐งต ThreadLocal drivers, @ScenarioScope beans, a device pool with port isolation
One mechanism worth knowing if you're going cross-platform: AppiumFieldDecorator reads the annotations on each field and selects by driver type at runtime. Declare @AndroidFindBy and @iOSXCUITFindBy on the same field, and an AndroidDriver session reads the first and ignores the second โ an IOSDriver session does the reverse. You keep one screen object class and one set of step definitions, and switch platforms through configuration alone.
Every hands-on part ships with a complete, runnable code workspace.
๐ Read the full guide here: https://www.mobile-automation.io/build-a-mobile-test-automation-framework/
Top comments (0)