This blog post does not explore Retrofit nor OkHttp and all their glory. Instead, we are looking into OkHttp’s testing API and how to use that to provide confidence into our codebase.
Testing is often daunting but crucial for software development. I am going to keep this post short and sweet. We will explore together the OkHttp‘s “MockWebServer” and how to integrate with Retrofit.
Target Audience: Retrofit Users
Writing tests is an important part of software development and dare to say not an easy task. There are many practices, libraries, books, podcasts, web courses dedicated to testing. Without testing we can ship a software with “1 to N” number of bugs.
Personally, I am a fan of the following technique which helps developers write tests and provides a template guide on how-to form your tests.
Arrange Act Assert (AAA) a pattern for arranging and formatting code in [UnitTest](a pattern for arranging and formatting code in UnitTest methods ) methods