Advanced HTTP Mocking with WireMock

Create HTTP mocks for your Android app with WireMock for deterministic testing and development. Don’t have mocks yet? No worries. You can record live traffic with WireMock that can be saved and played back. Testing apps that rely on APIs can be painful, flaky and complicated because more than likely, the APIs you rely on are out of your control. It’s time to take control back. WireMock can run as an embedded HTTP server on an Android device, but also can be run on your desktop to help with common development and testing tasks. During this talk, you'll learn how to record and playback network traffic, programmatically setup mocks, simulate error scenarios & latency, verify HTTP calls with mockito-like syntax, and simulate stateful behavior using "scenario" mappings (same endpoint, different responses). You'll also learn best practices and lessons learned from our use of WireMock with the Capital One Wallet app. Our testing and development teams have used it for the last 2 years, and I like to call it the "Swiss Army Knife" of HTTP. It has played a key part of creating reliable instrumentation tests and a "mock" (offline) flavor of our app.

Sam Edwards, Capital One

Sam is a Lead Android Engineer for Capital One Wallet. He has been working with Android since 2011 and has passion for clean, testable code, and developer productivity. Check out where he shares tips and tricks about Android and software development.