Enhancing Appium Android Tests with Advanced Techniques
Article Summary
Raj Varma from Bumble's engineering team reveals how to give your Appium tests superpowers. His solution lets test code directly call methods inside your Android app—solving problems that seemed impossible.
Appium tests run completely separate from app code, creating major limitations. Varma engineered a 'backdoor' approach that instruments the app with a modified Appium server, allowing tests to invoke app methods via Java reflection. This enables control over unpredictable app behavior and mocking of features Appium doesn't support.
Key Takeaways
- Modified Appium UiAutomator2 server runs in same process as app under test
- Tests can disable random popups, mock device shake, and control A/B test variants
- Custom /backdoor endpoint invokes app methods using Java reflection APIs
- Solution requires one time setup: instrument app, sign with same keystore, replace bundled APK
By instrumenting your Android app with a modified Appium server, you can call any public method from your test code, eliminating flaky tests caused by unpredictable app behavior.
About This Article
Appium doesn't natively support certain Android features like device shake gestures. Testers have to find workarounds because the UiAutomator2 driver has endpoints that exist but aren't implemented.
Raj Varma combined Appium's instrumentation test and HTTP server into a single APK. He then modified the manifest to target the app under test and signed it with the same keystore.
The backdoor endpoint lets test automation code call any public method from the application through Java reflection APIs. This removes the need for workarounds and allows return values to come back to test code.