Testing in Android Part 4: Mock API Calls Or Not?
Using OkHttp Mock Web Server and Compose waitUntil
Introduction
This series of testing consists of three parts, but I’m going to add a couple more parts to cover a common use case that makes this series a complete guide for Android developers.
Until now we’ve covered testing repositories, UI, and testing data sources like a local database(Room Library). Most of the apps rely on APIs, Local databases, or both, so in parts three and four, we’re going to cover how to write UI tests that are linked to asynchronous background work.
This part of the series is going to focus on understanding the problem with background tasks related to UI tests, and learning how to solve them. The next, and final part is focused on enhancing the solution with the idle resource concept(if you’re new to this, don’t worry, we’re going to cover everything from scratch).
I highly recommend reading the prequel parts in this series if you’re new to testing before going further:
- Testing in Android Part 1: Unit Tests
- Testing in Android Part 2: Integration Tests
- Testing in Android Part 3: End-to-End Tests
- Testing in Android Part 4: Mock API Calls Or…