Advantages over MockWebServer from Square #9
Replies: 1 comment 1 reply
-
Hi @GianlucaVeschi , I'd say the use case is different. MockWebServer is mainly used for tests, where you wanna stub different response(s) in different test case scenarios. Retromock is used to stub responses in the ApiService (not in tests) to ease development in cases of API related issues (not available at the moment, not developed yet, cannot access some flow that depends on some response). That allows us to run our apps in development and access all flows of the app even in such cases. Although you can do the same with MockWebServer under the hood, it requires much more hand written code to be able to do that. In Retromock you can stub response simply by annotating a method, so it is easier to implement and to change. We use MockWebServer in our tests as it is more easier to redirect all requests to the mock server and stub responses. Although it is possible to use Retromock in tests also, I would say MockWebServer is more robust for test cases. Does this answer your question? Feel free to clarify your use case if I wasn't clear in something. |
Beta Was this translation helpful? Give feedback.
-
I would like to try it out but I have seen that there is already a mocking library from Square. Are there any advantages in using Retromock over Square's MockWebServer?
https://github.com/square/okhttp/tree/master/mockwebserver
Beta Was this translation helpful? Give feedback.
All reactions