Understanding Hoverfly Cloud

A glossary for developers

Hoverfly Cloud is a powerful tool designed to streamline API development and testing. At its core, Hoverfly acts as a virtual service layer that intercepts and simulates API responses, allowing developers to isolate their applications from external dependencies. This isolation enables efficient development, testing, and debugging, ultimately accelerating time-to-market. 

To fully leverage Hoverfly Cloud’s capabilities, it’s essential to grasp key terms and concepts. This glossary provides easy to understand definitions and explanations of terms commonly used within the Hoverfly ecosystem. Whether you’re a seasoned developer or just starting to get to grips with API simulation, this glossary will equip you with the knowledge needed to make the most of Hoverfly Cloud. 

Features
Column 1
API
Application Programming Interface - A way for software to communicate. The most popular protocol used for API's is HTTP/S which is what Hoverfly Cloud is built to simulate.
API simulation
API simulation, also known as API mocking or API stubbing, is a technique used in software development and testing to mimic the behavior of an API (Application Programming Interface) without actually connecting to the real API. API simulation is a virtualization technique.
Behaviour
Behaviors are intended to create specific conditions to support testing. A wide range of behaviors is supported including HTTP header errors, data errors, latency simulations and more. This is very useful for understanding how your application behaves under stress or in unpredictable production environments. Behaviours can be applied to individual services or scenarios. A 'business as normal scenario' can be reconfigured with behaviors to predictably inject a variety of errors, for instance retail application could have a Black Friday scenario where there is adverse network latency.
Capture Mode
In this mode, Hoverfly services act as a proxy to an existing real HTTP API, whereby any requests made via the proxy and returned via the proxy are recorded into a simulation.
Handlebars
Handlebars syntax is the syntax used by the templating engine to indicate that the text within the {{ handlebars }} should be evaluated as an expression.
hcc
The Hoverfly Cloud command line tool (hcc) can be used to: Create simulations locally by capturing and exporting traffic between a client and an API, Upload simulations to Hoverfly Cloud, Start and stop remote Hoverfly Cloud services and scenarios, Provide a local reverse proxy server for accessing an authenticated Hoverfly Cloud service. The Hoverfly Cloud CLI requires an API token to authenticate with Hoverfly Cloud. It can be installed on development machines or continuous integration servers.
Latency
Latency in software development refers to the delay or the amount of time it takes for data to travel from its source to its destination, often measured in milliseconds, and it can be caused by factors such as network communication, data retrieval, or processing time, impacting the overall performance and responsiveness of a software system or application.
Mock
In software development, a mock is a simulated object or component that mimics the behavior of a real system element, typically used for testing and isolating specific parts of code.
Passthrough Mode
In this mode, Hoverfly services act as if they are not there. Purely for convenience, this mode will pass all requests and responses straight to the real API and back to the caller for when you want to use the real API without having to reconfigure the environment.
Proxy Server
Hoverfly services can run as proxy servers, where they intercept requests from the caller and forward them on to the destination API. They also handle the response before sending it back to the caller. Hoverfly in capture mode - acts as a proxy server - where it records all traffic between the caller and the destination API.
Request Matcher
A Hoverfly simulation consists of request/response pairs. The request part of each pair, is in fact a set of configured request matchers. These are rules that define how the Hoverfly service will decide on how to match an incoming request. Request matchers can be configured against all parts of the request such as the method, header values, path, query and payload in the body. They can use regular expressions , wildcard expressions, exact text comparisons, or various JSON and XML query expressions in their configuration. If all the request matchers configured for a request/response pair are succesfully matched, then the corresponding response part of the pair will be returned.
Request/Response Pair
A Hoverfly simulation consists of request/response pairs. Hoverfly will return a response when the correspoding request matching rules, or "request matchers" - have been satisfied.
Requests Per Second
RPS or request per second is the rate at which a service can respond to requests.
Scenario
A scenario is a collection of services. For example, suppose you are testing an application to support mortgage approvals. A scenario would define multiple services such as the Land Registry to validate the property reference, postcode validation, customer validation, credit checks, and so on. This complex data-rich set of services would change each time you change and test your application. You would be forced to manually test your application. Using a Hoverfly scenario you could capture the multiple interactions with services and allow the test to be automated. Scenarios can be combined with behaviors. A 'business as normal scenario' can be reconfigured with behaviors to predictably inject a variety of errors, for instance retail application could have a Black Friday scenario where there is adverse network latency.
Service
Hoverfly Cloud services simulates real HTTP services such as web APIs and SOAP services. You can think of Hoverfly Cloud services as API simulations, over the wire test doubles, or more highly configurable HTTP stubs and mocks. A service runs a simulation.
Simulate Mode
In this mode, Hoverfly services act as a webserver to serve up a pre-configured simulation consisting of pre-recorded or coded HTTP request/response pairs. In addition in Simulation mode, Hoverfly can adopt different matching strategies and use a combination of response templating and behavior injection to simulate realistic data and physical API behaviors.
Simulation
Hoverfly Cloud captures the interactions of a HTTP service in a simulation file. Simulations are JSON files that contains pairs of HTTP requests and their corresponding HTTP responses, also known as request/response pairs. A Hoverfly service will run a Hoverfly simulation
Spy Mode
In this mode, Hoverfly services act primarily as a webserver exactly as in Simulate mode, but, if the matching strategy cannot find a response to match a given request, to then act as a passthrough proxy to the real service and return the actual API response.
State
Hoverfly services can track a state and transition between states on successive requests to the same endpoint. This is useful for situations where a response should change as you cycle between requests - for example a traffic light switch, or to simulate a service that reports on the changing status of an order transistioning from being placed, to validated, to shipped, etc.
Stub
In software development, a stub is a minimal implementation of an interface or component that provides predefined, static responses to method calls, used for testing and isolating code during development and testing.
Templating
Response Templating in Hoverfly Cloud makes use of syntax to give your response access to variables sent in the request, perform equality logic, and perform conditional logic in structuring your response. It also allows you to generate synthetic test data. This gives you fine control over the content that is rendered into each response.
Virtualization
Virtualization in software development refers to the creation of virtual environments that mimic the behavior of physical hardware or software components. These virtual environments can run on a single physical system and are used for various purposes in software development, testing, and deployment. Virtualization can be applied to different layers of the software stack, including hardware, operating systems, and applications. API simulation is a subset of virtualization.
Web Server
Hoverfly instances can run as web servers, where they listen for requests and play back responses based on how the simulation has been configured. When Hoverfly services are running in "simulate" mode, they are running as web servers.