Badoo Raj Varma Feb 13, 2018

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

Critical Insight

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.

The article includes real production examples from Bumble, plus a warning about the responsibility that comes with this much testing power.

About This Article

Problem

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.

Solution

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.

Impact

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.