Using data sources in simulations

(Enterprise customers only) Hoverfly Cloud supports the use of CSV data sources so that you can do key value data lookups within your simulations.

Attaching a data source to a simulation

You can upload a csv file when editing your simulation from the Simulation tab.

Note that you cannot edit the data sources on a simulation already running on a service.

Looking up a data value from within the response template

To use the data in the csv file, you need to use the {{ csv }} templating function.

{{csv '<data-source-name>' '<key-column>' '<key-value>' '<return-column>'}}

So for example given a data source named "products" with the following csv structure:

You can use the following syntax to render the word "shirt" in a response template (note the use of single quotes):

{{csv 'products' 'productId' '101' 'productName'}}

Last updated