OkHttp offers a MockWebServer as a separate library called "mockwebserver".
Similarly, Retrofit provides a library named "retrofit-mock".
What is the difference between those two libraries? Which one should we use for doing instrumentation testing on Android?
According to JakeWharton
MockRetrofit is about stubbing your API before it gets to the HTTP client. If you want the full HTTP stack you should use something like MockWebServer in OkHttp to simulate a server and allow customizing the requests and responses to whatever you'd like.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With