Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why would I use MockWebServer instead of WireMock?

Every time when I need to mock some http requests my first choise is WireMock (which is actually standard for that I think), but today I discovered some alternative tool - MockWebServer.

What are pros and cons of WireMock vs MockWebServer?

like image 356
Paweł Szymczyk Avatar asked Jun 06 '17 06:06

Paweł Szymczyk


People also ask

Why we should use WireMock instead of Mockito?

Why We Should use WireMock Instead of Mockito? Wiremock provides a simulator for HTTP-based APIs while Mockito provides the mock implementation of the method/object.

What is the purpose of WireMock?

WireMock is a library for stubbing and mocking web services. It constructs an HTTP server that we can connect to as we would to an actual web service. When a WireMock server is in action, we can set up expectations, call the service and then verify its behaviors.

What is the use of WireMock in spring boot?

WireMock is a mock server for HTTP-based APIs. Some might consider it a service virtualization tool or a mock server. It enables you to stub out an API or other external dependency you depend on to expedite local development. It supports testing of edge cases and failure modes that the real API won't reliably produce.

What is default port for WireMock?

Note: When you specify this parameter, WireMock will still, additionally, bind to an HTTP port (8080 by default). So when running multiple WireMock servers you will also need to specify the --port parameter in order to avoid conflicts.


1 Answers

Basically MockWebServer was invented to run smoothly on Android devices. There were several problems with WireMock setup on Android and thats why MockWebServer was invented.

If you use mocking on your backend though then I recommend WireMock since it's more feature rich.

There is nice article on the topic here:

https://handstandsam.com/2016/01/30/running-wiremock-on-android/

especially My recommendation section

like image 159
pixel Avatar answered Oct 01 '22 06:10

pixel