Android Testing with Mocking
Article Summary
Abha Gupta from Walmart Global Tech tackles one of Android testing's toughest challenges: running mock servers inside your APK for reliable device farm testing. No external dependencies, no flaky tests.
When scaling Android tests across device farms, traditional mock server approaches fall apart because there's no application server to start. Gupta's team investigated multiple solutions and adapted WireMock to run directly inside Android apps, solving the HTTPS challenge with BKS keystores.
Key Takeaways
- WireMock runs on Jetty, making it perfect for embedding in Android APKs
- Android requires BKS keystores instead of Java's standard JKS for HTTPS
- Mock server runs inside the app itself, enabling true parallel test execution
- Custom SSL context factory bypasses Android's missing endpoint identification methods
Critical Insight
By embedding WireMock directly in Android test APKs with BKS keystore support, teams can create massive parallel test suites that run reliably in device farms without external mock server dependencies.