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

Data test strategy and Service Virtualization

Actually I’m digging in different SV (=Service Virtualization) Solution like HP SV, OSV from Tricentis and CA SV. In this context, it allows you to cut from production the real data and play with test data.

What commercial SV can do for you?

  1. Record transactions : You record all the transactions you need for your test scenarios, then the system is playing back all the responses as required.
  2. Scripting the service with a business logic if you need some complex response.
  3. Data driven set : Allows you to fill an Excel spreadsheet or any data container with all the data you require for your test scenarios. Your data set need to be “stateful business process” oriented, that means during the data lifecycle, the object could change state and value.

This last feature will be a good candidate if you are stuck with a legacy or new applications in order to put in place a test data set. The majority of the commercial tools could work with different protocol (http/https, MQ, Filesystem, Ftp/s, etc…). And if the price is a show stopper and you require only http/https, some open source tools are also good candidates. Here you can find a good list of open source and commercial tool.

Samy Kacem