Hoverfly Cloud Blog

Hoverfly modes: Guide to API software testing and simulation

Written by Hoverfly Cloud Team | Sep 18, 2024 1:30:00 AM

In today’s fast-paced development landscape, ensuring the smooth functioning of your applications hinges on robust and efficient API software testing. But what happens when external dependencies or incomplete APIs hold you back? Enter Hoverfly, a game-changer in the world of API testing. 

 Hoverfly transcends the limitations of traditional testing by offering a versatile suite of modes, allowing it to function in multiple ways: 

Capture Mode:
Seamlessly record and create simulations from real API traffic reality for future reference 

In Capture Mode, listen to real API interactions, record them, and turn these interactions into simulations. Capture Mode allows you to replay these scenarios in the future without needing the real API.

Imagine a world where testing doesn’t require constant access to real APIs. With Hoverfly’s Capture Mode, you can achieve just that. This mode acts as a proxy, seamlessly intercepting requests made to Hoverfly and forwarding them to the actual API. The magic lies in the background – Hoverfly meticulously captures every interaction, recording the request and response pairs into a simulation file. This valuable data becomes the foundation for future testing, so you can create realistic simulations or mocks even without constant access to the real API. 

Ready to unlock the power of Capture Mode? Book a free demo today and see how Hoverfly can streamline your API software testing process. 

Passthrough Mode:
Act invisibly, allowing direct interaction with the real API

Passthrough Mode forwards all requests to the real API without interference. It’s like Hoverfly Cloud isn't there, ensuring uninterrupted and authentic communication with your live systems. 

Passthrough Mode, as its name suggests, simply forwards all requests directly to the real service without attempting to match or simulate them. This mode acts as a conduit, allowing requests to flow seamlessly to the real API and back without any intervention. This is ideal for scenarios where you want to interact with the real API without modifying the environment or incurring additional overhead.

By enabling Passthrough Mode, you effectively bypass Hoverfly’s simulation and matching capabilities, ensuring that requests are processed directly by the real API. This can be particularly useful during development, testing, or troubleshooting phases when you need to verify the behaviour of the real API or isolate potential issues. 

Simplify your API mocking and  simulation with Passthrough Mode. Book a free demo today and discover how Hoverfly can save you time and effort.

Simulate Mode:
Fully emulate your APl, providing realistic responses based on pre-recorded simulations.

In Simulate Mode, Hoverfly Cloud steps in as the API itself, responding with previously captured data. If it encounters something new or unexpected, it will fail, ensuring only accurate and pre-defined responses are delivered.

Once you’ve captured your real API interactions, it's time to harness that data. Hoverfly’s Simulate Mode lets you create custom simulations, tailored to your specific testing needs. By leveraging the recorded request and response pairs, you can construct a virtual replica of your API, allowing you to isolate testing efforts and conduct them independently. 

This is the mode Hoverfly runs in when it imitates the real API. Requests are served by Hoverfly and do not pass to the real API. In Simulate mode, Hoverfly acts as a webserver to serve up a pre-configured simulation consisting of pre-recorded or coded HTTP request/response pairs. Additionally, in Simulate Mode, Hoverfly can adopt different matching strategies and use a combination of response templating and behaviour injection to simulate realistic data and physical API behaviours. 

Want to explore the possibilities of Simulate Mode? Book a free demo today and experience the flexibility and control it offers. 

Spy Mode:
A hybrid approach for comprehensive testing 

Spy Mode primarily simulates the API but automatically passes requests through to the real API if it doesn't recognise the interaction. This ensures that your application remains functional, even if a simulation is incomplete.

Hoverfly’s Spy Mode combines the best of both worlds, seamlessly integrating simulation and proxying. It primarily functions as a webserver, serving simulated responses based on your pre-recorded data. However, if the simulation encounters an unfamiliar request, Spy Mode gracefully transitions to proxy mode, forwarding the request to the real API and capturing the response for future reference. This intelligent approach ensures comprehensive testing coverage, even when unexpected scenarios arise.

In this mode, Hoverfly primarily acts as a webserver, similar to Simulate Mode. However, if the matching strategy cannot find a suitable response for a given request, it then acts as a pass-through proxy to the real service and returns the actual API response. This is particularly useful if your simulation does not account for every possible request combination and needs to rely on the real API to respond in such cases.

Interested in the benefits of Spy Mode? Book a free demo today and see how Hoverfly can enhance your API mocking and simulation testing strategy. 

Master every Hoverfly mode and unlock its full potential for seamless API testing! Dive deeper in our docs: Hoverfly Service Modes.