Skip to main content
This IDE plugin provides support for various WireMock OSS features as well as integration with WireMock Cloud.

Install the WireMock plugin

The plugin is available on the JetBrains Marketplace.
  1. Press ⌘Сmd, on Mac or CtrlAltS on other platforms to open settings and then select Plugins.
  2. Open the Marketplace tab, find the WireMock plugin, and click Install (restart the IDE if prompted).

Setup

The WireMock plugin comes with features that utilize users’ existing WireMock Cloud accounts and integrates local files with them, e.g. creating remote mock APIs from local stub mappings. So, if you have a WireMock Cloud account and want to connect to it and use Cloud specific features, head to the plugin settings at Settings | Tools | WireMock and log in to your account. Otherwise, no specific setup is required.

Log in to WireMock Cloud

When WireMock is first installed, it is necessary to log in to your WireMock Cloud account, in order to be able to use related features. Logging in can happen at two different locations: via an editor notification after opening stub mappings files, or from the plugin’s settings UI.
Credentials are stored safely by the IDE (on the IDE level), so
  • they are completely separate from any WireMock CLI installation on the system,
  • and if you are using the plugin in multiple IDEs, you have to log in in each of them.

From the editor notification

Upon opening a stub mapping JSON file, the following notification appears at the top of the editor. It provides a way to create an account if you haven’t already, or to use your existing account. WireMock Cloud editor notification when not logged in To start the login process, click on the Log in link. This performs two things:
  • shows a balloon popup with your verification code
  • opens the login page in your web browser showing you a verification code
In case the page would not open, you can copy the verification URL from the popup. WireMock Cloud authentication confirmation balloon Make sure that the two codes match, then confirm the device code. In a few seconds the IDE will show you another balloon confirming your login.

From the plugin settings

You can also log in to your account via the plugin settings at Settings | Tools | WireMock. The flow is similar to the one described in the previous section, but it is handled entirely on the settings UI, and you also have the option to Cancel Login. WireMock Cloud settings not logged in When the login is successful, the UI will show you the email address you are logged in with, or will notify you if a problem occurred during the login.

Use with On-Premise Edition

The plugin also supports work with the on-premise edition of WireMock Cloud. To turn on this feature, enable the Use with On-Premise Edition option, update the necessary configuration values, and log in. If you are already logged into a different installment of WireMock Cloud, make sure to log out, save the settings, and log in again. WireMock Cloud settings on-premise

Create mock APIs and import stubs

If you want to convert local stub mappings to remotely hosted WireMock Cloud mock APIs, you can do so: open a stub mapping file, then click on the Create mock API link in the top notification, or the icon in the floating toolbar. WireMock Cloud create mock API options
These actions are shown only when you are logged in to a WireMock Cloud account.
This will display a dialog (detailed in the sections below) to specify the properties of the new mock API. Submitting the dialog creates an empty, remote mock API with the specified name and custom hostname, and immediately imports/uploads the stubs from the open mapping file into that new API.

Mock API properties and types

When you initiate the mock API creation, you are presented with a dialog to specify the API name, an optional custom hostname and the type of the API to create. WireMock Cloud create mock API dialog The following API types are supported:
  • Unstructured (WireMock)
  • REST
  • GraphQL (+ non-federated schema)
  • gRPC (+ descriptor file)
If you choose GraphQL or gRPC you must also upload a schema/descriptor file with them. Creating a mock API without them is not permitted. WireMock Cloud create mock API with GraphQL

Completion of the API creation

The creation of the mock API and data upload into it is performed in two or three separate phases depending on the API type:
  • API creation and stub upload for Unstructured and REST,
  • API creation, stub upload and schema/descriptor upload for GraphQL and gRPC
Thus, when all phases finish without any issue, a separate balloon notification appears for each phase. The first one also provides a link with which you can easily open the new API in your browser. WireMock Cloud create mock API with GraphQL If any phase fails for any reason, notifications with appropriate messages will let you know of the failure and the reason of it.

Import stubs into existing mock APIs

Besides uploading stubs into newly created APIs, you can also upload them into APIs that already exist in your WireMock Cloud account. You can do so by opening a stub mapping file, then clicking on the icon in the floating toolbar. WireMock Cloud import stubs into existing mock API options
This action is shown only when you are logged in to a WireMock Cloud account.This feature adds the uploaded stubs to the target mock API without deleting existing stubs.
In the appearing dialog you can find and select the target API to upload stubs into. WireMock Cloud select mock API dialog When opening the dialog, it displays all available mock APIs. After that you can perform searches with arbitrary query strings (it is case-insensitive) either by clicking the button or by hitting Enter. It looks for matches in APIs’ names, base URLs and descriptions too. (Showing descriptions is not yet supported.) If you’d like to reset the results and see all available mock APIs, perform a search with an empty string.

Mock APIs list

The matching mock APIs are listed in this table with their names, base URLs and types shown. Each result page shows up to 20 items (that value is not customizable), and the table allows selecting at most 1 mock API as the target. If no API is selected, the dialog cannot be OKed. On top of initiating the stub import using the OK button, double-clicking on a mock API also does the same. To locate an API easier on the current page, you can use speed search: click somewhere in the table, then start typing. When there is a match, the first matching row will be selected. WireMock Cloud select mock API speed search

Pagination

This component lets you navigate through the current result set. It supports moving to the First, Previous, Next and Last pages when applicable, as well as to arbitrary pages. To initiate the navigation to a specific page, specify a valid page number and hit Enter. If it is initiated with a number
  • less than 1, or a non-integer, it will load the first page
  • greater than the total number of pages, it will load the last page
In addition, when an invalid page number is entered, the field displays an appropriate message, for example: WireMock Cloud select mock API pagination error

Initiating the stub import

When the dialog is OKed, the stub import begins, and the same logic, including handling failure scenarios, is performed as when uploading stubs via the Create mock APIs and import stubs feature.