This workflow is successfully implemented for some of our customers. Please note that the results can vary depending on individual configurations.
WireMock plays a crucial role in service virtualization by allowing users to easily mimic a production API's behavior. This capability is essential for various testing scenarios, including:
Building test assets even when the production APIs are not ready or released.
Reducing test flakiness by stabilizing interactions with third-party APIs.
Simulating edge cases and faults to facilitate unhappy path testing.
This guide demonstrates how to integrate Katalon Studio with WireMock Cloud to create and test mock versions of APIs. For those who prefer a visual walkthrough, a video version of this tutorial is also available here.
Upon completing these steps with WireMock Cloud's traffic record function, you should see a new stub in the list:
Note: In addition to creating a mock of an existing API, WireMock Cloud offers several methods to set up a mock API. For more information, see WireMock Cloud documentation.
You can create a new stub within Katalon Studio without needing to use the WireMock Cloud user interface. Simply send a POST request with the desired data to set up the stub in WireMock Cloud.
Follow these steps to create a new stub using Katalon Studio:
Select File > New > Web Service Request.
In the displayed New Web Service Request dialog, name the request, specify the request type as RESTful, and enter the URL for managing stub mappings. Then, click OK.
Here's how to get the URL:
Go to WireMock Cloud app's home screen, select your created mock API.
In the HTTP Header section, add specific Name and Value as shown below:
You can find the Value of the Authorization in the Usage examples section above.
In the HTTP Body section, choose text, then input your stub mapping definition.
For example, the text { "request": {"url": "/hello-world" }, "response": { "body": "Hi!"}} is a JSON object that defines a stub mapping. This JSON object specifies the request to be matched and the response to be returned by WireMock Cloud.
Hit the Test Request button.
The POST request will create a mock endpoint in WireMock Cloud, allowing remote connection to the WireMock Cloud server from Katalon Studio.