Hoverfly

Let’s do a quick overview on this open source tool for Service Mocking / Service Virtualization.

Pre-requirement

  • Using v0.11.0
  • For test purposes we are using ft-demo-website
  • Docker (if you want to use it, it is optional)

Introduction

There 3 ways of using Hoverfly:

  • Using mainly for stub purpose, we set a json file that configure the appropriate answer we want. Mainly there are static answers. You can see the demo.
  • Using as simple mock with middleware in python.
  • Have a more complexe mock for complex workflows using Hoverfly Java.

Demo

For the demo we took the first way of doing, just stubbing. You can see the demo. We are mainly 2 simples configurations:

  • We record a api call. We have created a bash script that generate the json file you will need to reuse for replay purpose.
  • We replay the api call. We have created a separate bash script that start locally a replay api call. It will use the json of the first step.

That’s it!

Docker

Now when you have your json for replay you can create a docker for mocking. Just one single command line:

docker run -d -p 8888:8888 -p 8500:8500 spectolabs/hoverfly:latest -import ${HOVERFLY_JSON_URL}

References

Samy Kacem

Leave a Reply