Writing instrumentation tests on Android can be quite difficult, especially if you are just starting out. Mocking API calls or testing different error scenarios can quickly become a nightmare.

TL;DR Add a JSON file of your responses into a resource folder. Create a MockWebServer dispatcher which returns these JSON mocks. Replace your Base Url Module with a Fake Url Module using UninstallModules and InstallIn annotation. Launch your Fragment in a container. Write your test using Espresso. If you want a complete code example of a running test with mocked responses you can scroll down to the bottom.

Thankfully nowadays we…


How I won the race with ReplaySubject … 🏃

Replay this 🔉 🎵 …

Hello fellow developers …

Everybody knows how cool RxJava is and how it can help you easily solve concurrency issues or race conditions in Android applications. Rxjava requires a paradigm shift away from the normal imperative approach. It is reactive based, where bits and pieces of code aren’t executed until it knows it’s end mean. Today I am going to bring you a problem and solution using RxJava’s ReplaySubject, that for some, may not be quite straight forward.

If you have never heard of Subjects in RxJava you can find a quick description below of what it is and how…

Ashley Figueira

Android Developer @ Pulselive

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store