Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Differences between OkHttp Mock Web Server and Retrofit Mock

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?

like image 771
GianMS Avatar asked Nov 18 '22 08:11

GianMS


1 Answers

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.

like image 182
xxfast Avatar answered Jun 16 '23 22:06

xxfast