Easy way to Mock REST services
By Chathurika Sandarenu
These days we are working more and more with REST web services. Most of the times we are writing clients to access 3rd party sevices hosted in a remote server or even local services. Sometimes in large teams one group is developing the server and other group is writing the clients to use them. In such situations client team might need to test their clients without the availablity of the real service. They only have the API definition.
In last few months I came accross such situations multiple times. So I wanted to find out a fast and easy way to simulate(mock) a REST service. That is when I found out about the WireMocks capability to create simple REST simulators very easily. I knew about WireMock before and had used it in intergration testing. But on those times I had used them with JUnit.
Same Wiremock can be used to create simulators very easily. We can define request/response formats in a JSON file and use Wiremock to serve them. I have created a sample simulator in Github. Have a look and see how easy it is to create a simulator…