Service Virtualization Using Hoverfly from SpectoLabs

Agenda:

To simulate and capture api responses using hoverfly.

Steps:

  1. Configure hoverfly from this site - https://hoverfly.io/
  2. Start hoverfly by using this command - hoverctl start
  3. Enter into capture mode - hoverctl mode capture
  4. Capture response from this api - http://time.jsontest.com
    1. curl --proxy http://localhost:8500 http://time.jsontest.com
    2. Note: http://localhost:8500 is the proxy
  5. Export response - hovertcl export simulate.json
  6. Edit the file if needed and import back - hoverctl import simulate.json
  7. Enter simulate mode - hoverctl mode simulate
  8. Invoke curl command
    1. curl --proxy http://localhost:8500 http://time.jsontest.com
  9. You should receive the mocked response :-)
Note:
Instead of using curl command, you can use postman by configuring proxy as shown below.
Postman --> settings --> Proxy --> Proxy configurations for sending requests --> Add a custom proxy --> configure proxy server and port


Comments

Popular posts from this blog

TestNg - Test Automation Framework

React Js and Redux

Appium 7 - Android Test Automation