Hoverfly

Create API simulations.
Use them to develop and test faster.

Sign up for Hoverfly Cloud

Find out about Hoverfly Cloud: hosted API simulations for your CI pipeline

Light-weight, super fast

Replace unreliable test systems and restrictive API sandboxes with high-performance simulations in seconds.

Run anywhere

Run on MacOS, Windows or Linux, or use native Java or Python language bindings to get started quickly.

Customize and extend

Simulate API latency or failure when required by writing custom scripts in the language of your choice.

What people say

“The fastest and easiest way to get started with service virtualization”


Alex Soto, RedHat



“Hoverfly is rapidly becoming an important player in the world of open source service virtualization solutions.”


Bas Dijkstra, OnTestAutomation.com



“Hoverfly solves some of the biggest problems with modern microservice development.”


Nic Jackson, NotOnTheHighStreet

Get Hoverfly

Get Hoverfly

Download

MacOS 64bit

Download the archive and extract it to a directory on your PATH.

Or use Homebrew.

brew install SpectoLabs/tap/hoverfly

Quickstart

Hoverfly comes with a command line tool called hoverctl.

hoverctl start

Capture an HTTP request and response.

hoverctl mode capture
curl --proxy http://localhost:8500 http://time.jsontest.com

You have just created a simulation.

hoverctl export simulation.json

Set Hoverfly to simulate mode and make the same request.

hoverctl mode simulate
curl --proxy http://localhost:8500 http://time.jsontest.com

The response was returned by Hoverfly.

Next steps

Download

Windows 32bit   |  Windows 64bit

Download an archive and extract it to a directory on your PATH.

Quickstart

Hoverfly comes with a command line tool called hoverctl.

hoverctl start

Configure your application or browser to use the Hoverfly proxy on localhost:8500.

Set Hoverfly to capture mode.

hoverctl mode capture

Make a request from your application or browser. You have just created a simulation.

hoverctl export simulation.json

Set Hoverfly to simulate mode and make the same request.

hoverctl mode simulate

The response was returned by Hoverfly.

Next steps

Download

Linux 32bit  |  Linux 64bit

Download an archive and extract it to a directory on your PATH.

Quickstart

Hoverfly comes with a command line tool called hoverctl.

hoverctl start

Capture an HTTP request and response.

hoverctl mode capture
curl --proxy http://localhost:8500 http://time.jsontest.com

You have just created a simulation.

hoverctl export simulation.json

Set Hoverfly to simulate mode and make the same request.

hoverctl mode simulate
curl --proxy http://localhost:8500 http://time.jsontest.com

The response was returned by Hoverfly.

Next steps

Hoverfly Java

Hoverfly Java is a native Java language binding for Hoverfly.

If you are using Maven, add the dependency to your pom.xml

<dependency>
    <groupId>io.specto</groupId>
    <artifactId>hoverfly-java</artifactId>
    <version>0.14.1</version>
    <scope>test</scope>
</dependency>

If you are using Gradle, add the dependency to your *.gradle file

testCompile "io.specto:hoverfly-java:0.14.1"

Quickstart

public class HoverflyExample {

    @ClassRule
    public static HoverflyRule hoverflyRule = HoverflyRule.inSimulationMode(dsl(
        service("www.my-test.com")
            .get("/api/bookings/1")
            .willReturn(success("{\"bookingId\":\"1\"}", "application/json"))
    ));

    @Test
    public void shouldBeAbleToGetABookingUsingHoverfly() {
        // When
        final ResponseEntity<String> getBookingResponse = restTemplate.getForEntity("http://www.my-test.com/api/bookings/1", String.class);

        // Then
        assertThat(getBookingResponse.getStatusCode()).isEqualTo(OK);
        assertThatJSON(getBookingResponse.getBody()).isEqualTo("{"\"bookingId\":\"1\"}");
    }

// Continues...

Next steps

HoverPy

HoverPy is a native Python language binding for Hoverfly.

pip install hoverpy

Quickstart

from hoverpy import capture, simulate
import requests

@capture("requests.db")
def captured_get():
    print(requests.get("http://time.jsontest.com").json())

@simulate("requests.db")
def simulated_get():
    print(requests.get("http://time.jsontest.com").json())

captured_get()
simulated_get()

Next Steps

© Copyright SpectoLabs 2018