Hoverfly Cloud
Visit Our Main SitePricingTry Hoverfly Cloud
  • Introduction
  • Use cases for API Simulation
  • Key concepts
  • What's New
  • Dashboard
  • Simulation
    • Create simulations
    • Configuring Request Matchers
      • JSON Request Matchers on the Body
        • EXACT Matcher
        • JSON Matcher
        • JSON Partial Matcher
        • JSONPath Matcher
        • Regular Expression Matcher
      • Handling the response when Hoverfly cannot match
    • Building a JSON Response
      • Using a JSON object from the Request
      • Looping over a JSON array from the Request
    • Simulating Webhooks and Callbacks
    • Using templating in simulations
      • Render back any part of the Request
      • Render synthetic data
      • Faker functions
      • Render dates and times with offsets
      • Conditional logic
      • Looping over arrays
      • Variables and Arrays
      • Arithmetic operations
      • String operations
      • Validation operations
      • Simulating a persistent backend
      • Transitioning state between requests
      • Combining and nesting templating functions
      • Useful helper functions
      • Avoiding HTML encoding in function return values
    • Using data sources in simulations
      • Querying data sources
      • Updating data in data sources
      • Deleting data from data sources
      • Inserting data into a data source
      • Guidance on using the SQL like syntax
    • Working with Simulation Files
  • Service
    • Start a new service
    • Use a service
    • Update a service
    • Configuring Journal Indexing
  • Command line interface
    • Hoverfly Cloud CLI commands
  • Tutorials
    • Quickstart
    • Creating simulations and services
      • Tutorial 1: Create a service and simulation manually
      • Tutorial 2: Create a service and simulation by importing from a Swagger specification
      • Tutorial 3: Create a service and simulation by capturing real API traffic
    • Response Templating
      • Tutorial 4: Response Templating
    • Hoverfly service modes
      • Tutorial 5: Simulate, Capture, Spy and Passthrough modes
    • Automating with the CLI and API
      • Tutorial 6: Using the CLI and the Hoverfly Cloud API
Powered by GitBook
On this page
  • Terminology
  • Considerations if you are running a service with an unsaved simulation
  • Considerations if you are running a service with a simulation from the library
  • Downloading simulations from the simulation library
  • Uploading simulations to the simulation library
  1. Simulation

Working with Simulation Files

Hoverfly Cloud stores the configuration of its API simulations in JSON simulation files.

One JSON file = One Hoverfly Simulation

This topic discusses

  • how these files are stored in Hoverfly Cloud

  • how they are applied to running services

  • how to keep different versions of them synchronized

  • how to upload and download them

Terminology

  • Services run instances of simulations.

  • Services are running web servers and can be viewed from the Hoverfly Cloud dashboard

  • Simulations are JSON files that represent an API simulation configuration - it's endpoints and matching configuration

  • Simulation files are stored in a simulation library accessed from the menu in Hoverfly Cloud

  • Simulations can be downloaded from, and uploaded to the simulation library

  • Services can be started using a simulation file from the library. When started in this way they make their own copy of the simulation file and any changes made to it from within that service are independent of the master simulation file stored in the simulation library. In this way a single master simulation can be shared with many service instances which will each take their own copy.

  • Services can also be started without a simulation file. In this case the service will have a simulation labelled (unsaved) when viewed from the dashboard.

Considerations if you are running a service with an unsaved simulation

In this case the service will have a simulation labelled (unsaved) when viewed from the dashboard.

This implies that the simulation that the service is running does not have a master copy in the simulation library. It was started without a simulation, and any configuration done to the simulation in this service is only in this service and cannot be shared.

You need to follow the following steps to add the unsaved simulation to the simulation library before you can download it, or before it can be used by other services that might need to.

Step 1: Click on (unsaved) simulation

Step 2: Click down arrow and Export simulation as new

Once you have exported the simulation it will appear in the simulation library from where it can be downloaded.

Considerations if you are running a service with a simulation from the library

In this case the service will have a named simulation when viewed from the dashboard.

When the service was started, it was done so using a simulation file from the simulation library.

The version of the simulation running in the service is a separate copy of the master simulation file and can be changed independently of the simulation file stored in the library.

If you wish to keep the version running in the service separately from the version stored in the library you need to export is as a new simulation file, with a different name to the version already in the library.

If you wish to overwrite the existing version in the library with any changes made to the version running in the service, you can synchronize the service's simulation with the library. This will overwrite what's in the library with what is currently in the service.

Downloading simulations from the simulation library

Click the download icon next to the simulation from the simulation library.

Uploading simulations to the simulation library

Click the Upload button from the simulation library

PreviousGuidance on using the SQL like syntaxNextService

Last updated 9 months ago