To get started Hoverfly Cloud, you need to understand a few concepts: Services, Scenarios, Simulations and Behaviors.
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.
Hoverfly Cloud uses our Open Source tool, Hoverfly to simulate a service. Hoverfly Cloud uses Kubernetes to run and manage multiple copies of Hoverfly, and adds a powerful GUI with many additional capabilities.
If you have used Hoverfly you will know that it 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.
You can also create simulations in Hoverfly Cloud. If you have an account you can see yours on the Simulations page here. Hoverfly Cloud also allows you to create simulations from Swagger Specification.
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.
Behaviors allow you to change a simulation quickly, for instance making your service simulation badly behaved except in a predictable way which is what you need for testing!
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. We recently had a case where customers were struggling to reproduce a problem seen in production in their test environment. Using Hoverfly Cloud they quickly replicated the problem using behaviors and fixed the problem.
You can use a Hoverfly Cloud scenario to model a business scenario, for example modelling a payment gateway where all services are working normally, or conversely a flaky third-party API that intermittently fails. A mobile banking app could then be tested to ensure it could handle all these situations appropriately.
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.
A scenario describes multiple services and their configuration data and can be started in seconds.
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.