Getting Started

This article is intended to help new users of WireMock Cloud get their first mock API up and running.

Overview

WireMock Cloud provides a number of ways to set up a mock API:

  • Manually via the web UI
  • Swagger or OpenAPI specification import
  • Record traffic to and from another API
  • Import an existing project from WireMock
  • Automate via the REST API or WireMock

Creating an account

Before you can proceed you’ll need a WireMock Cloud login, so if you’ve not signed up already then you can do so here.

Manual mock API configuration

Creating stubs manually in the web UI is often the simplest way forward if:

  • The API you’re mocking is quite simple (or you only need a small part of it)
  • You’re working from a specification document and you want to copy/paste examples into a running simulation
  • You just want to quickly explore what WireMock Cloud can do

After signup an example mock API will be created for you, showcasing different WireMock Cloud features. You can edit this or add your own stubs to experiment with WireMock Cloud’s capabilities.

If you’d like to start afresh and choose your own domain name, you can create a new mock API by clicking

More details on stub creation can be found in the Stubbing and Advanced stubbing articles.

For a more in-depth look at how WireMock Cloud can be used with a manual approach, see the exploratory testing tutorial.

Swagger and OpenAPI import

If you already have a Swagger or OpenAPI specification, you can import it and WireMock Cloud will auto-generate a set of stubs.

Swaggerhub users can integrate with WireMock Cloud via a webhook, so that the mock API will be updated each time a change is saved.

See Swagger Import for more details.

Record and playback

If you want to create a mock of an existing API which is accessible over the internet, you can configure WireMock Cloud to proxy (forward) traffic to it and record requests as stubs.

See Recording Stubs for details.

Importing from WireMock

WireMock Cloud uses WireMock as its underlying engine, so mock APIs created within WireMock can be directly imported into WireMock Cloud (and vice versa).

This can be useful when you need to record APIs that are only accessible inside your organisation or from a private network, or if you have existing projects utilising WireMock that you’d like to host in the cloud.

See the article on import and export for details on how to do this.

Scripting and automation

Sometimes automation is the best approach to maintaining the configuration of your mock APIs. Some reasons for this include:

  • You need to create hundreds or even thousands of stubs, so manual editing is impractical.
  • You’re mocking a fast-changing API, and generating stubs programmatically makes it easier to stay in sync.
  • Your team manages all configuration as code which can be kept in source control.

WireMock Cloud enables this approach by making all features available via its REST APIs.

The provisioning API supports the creation, querying and deletion of mock APIs.

The mocking API supports configuration of an individual mock API, including stub create/update/delete, request log querying and verification and more. It is 100% compatible with WireMock’s API and can therefore be used with any WireMock client library.

See the article on automated testing with Java to see how the Java WireMock library can be used to work with a mock API programmatically.