Create simulations

Capture using a Hoverfly Cloud Instance

The simplest way to create a simulation is by capturing real API traffic. The prerequisite is that the API you are going to capture must be available on public internet; use the Hoverfly Cloud Agent if the API is behind a firewall.

First you need to start an instance. Enter the base URL of the target API, for example “http://time.jsontest.com”.

Enter a name “my-service”, and change the mode to “capture”, and click “Confirm”.

Start instance in capture mode

Once you start making requests to the API, Hoverfly Cloud will capture the traffic behind the scene.

You can copy the curl or Hoverfly Cloud agent commands by clicking on the button.

See here for more details on making request to the instance.

Click on the simulation link and you can review what requests and responses have been captured.

Instance simulation

You can edit and export the captured simulation for future use.

Capture using Hoverfly Cloud agent

If the API you would like to capture is behind a firewall, you can use Hoverfly Cloud agent to do the capturing.

Start Hoverfly Cloud agent dashboard:

hoverfly-cloud-agent dashboard --api-token $HFC_TOKEN

The dashboard should be available on http://localhost:8900.

Click on capture, and specify the base URL.

Start local capture

You will get a localhost URL which you should make your requests to instead of the actual URL.

Running capture session

Once you are done, click “Stop” and it will prompt you to enter the name for the simulation.

Click “OK” will publish your simulation to your Hoverfly Cloud account.

Stop capture session

Create manually using Simulation Editor

It is also possible to create simulation of non-existent API. You can access the Simulation Editor in Simulation page by clicking “Create simulation”.

Create simulation buttons

Click on “Add request response pair” to add your first definition of the API.

Add and edit the request you want to match and the corresponding response.

You can click on “duplicate” to reuse existing pair.

Once you are happy about your simulation, you can click “Save”.

Create from Swagger Specs

Coming soon! Contact us to use the beta version.

From existing JSON files

If you are already using open source Hoverfly, you can upload your existing Hoverfly simulation file in the Simulation page:

Simulation uploader