From user sessions to multi-step transactions, learn how to reliably test your application’s interaction with dependent APIs using Hoverfly Cloud.
With interconnected software development, especially within a microservice architecture, APIs are rarely simple, stateless interactions. A real-world workflow often involves a sequence of calls where the response to one request is dependent on the result of a previous one. Think of a classic e-commerce checkout:
/basket
→ Returns a basketId
/payment/authorise
(with basketId) → Returns a transactionId
/order/subm
it (with transactionId
) → Returns a 201 Created
If your testing environment or a third-party payment gateway is unavailable, unstable, or too costly to use for high-volume testing, simulating this stateful journey becomes a significant challenge. Traditional mocks are typically limited to simple request-response matching, falling short when the internal state of the simulated service needs to evolve.
This is where Hoverfly Cloud’s advanced simulation features shine, allowing dev and QA teams to create highly realistic, stateful mocks. The key is in its ability to introduce persistence and dynamic response generation.
An important feature of Hoverfly Cloud is its capacity to simulate a persistent backend. It achieves this by logging and making previous request-response pairs accessible from its internal, in-memory journal. This transforms a stateless mock into a dynamic, state-aware one.
/basket
can generate a unique basketId
and save it. The subsequent POST to /payment/authorise
then checks the journal to see if the required basketId
exists and is valid before proceeding.Stateful workflows often require dynamic data, such as a generated token, a unique transaction ID, or a timestamp that is then re-used or validated in a subsequent request.
Hoverfly Cloud uses powerful Handlebars templating to inject logic and dynamic values directly into the response body or headers.
Scenario |
Hoverfly Cloud Technique |
Extract and Re-use |
Use the templating language to capture an element from the Request (e.g., a session ID from a header) and include it in the Response body. |
Generate Unique IDs |
Utilise built-in functions (like those from the Go-Faker library) to generate realistic, synthetic data on the fly (e.g., a valid-looking UUID, a location postcode, or a future date). |
Conditional Logic |
Employ conditional logic ( |
In high demand sectors such as financial services and e-commerce, time-to-market is everything. Simulating stateful workflows with Hoverfly Cloud directly translates to business agility:
If your team is struggling to reliably test complex transactions due to external API dependencies, Hoverfly Cloud offers a robust, cloud-hosted solution to bring consistency, control, and state awareness back to your development pipeline.
Find out more today and put us to the test. Request a demo to see how easy it is to simulate your most complex stateful workflows.