Tag: retrofit

Mocking API Responses using a Retrofit Client in Android (Retrofit 1.9)

Mocking API Responses using a Retrofit Client in Android (Retrofit 1.9)

Writing test cases in Android can be quite a daunting task, especially the handling of different server responses. Testing error responses can be quite problematic and your app might not cover all the different scenarios.

If you are using Retrofit 1.9 and below to do your network calls, testing error responses can be quite simple. There are a couple of ways to test Retrofit calls. In this post we will look at making the Client return different responses which are stored in .JSON files within the test project.

Read More Read More