Service Virtualization Using Hoverfly from SpectoLabs
Agenda:
To simulate and capture api responses using hoverfly.
Steps:
- Configure hoverfly from this site - https://hoverfly.io/
- Start hoverfly by using this command - hoverctl start
- Enter into capture mode - hoverctl mode capture
- Capture response from this api - http://time.jsontest.com
- curl --proxy http://localhost:8500 http://time.jsontest.com
- Note: http://localhost:8500 is the proxy
- Export response - hovertcl export simulate.json
- Edit the file if needed and import back - hoverctl import simulate.json
- Enter simulate mode - hoverctl mode simulate
- Invoke curl command
- curl --proxy http://localhost:8500 http://time.jsontest.com
- 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
Post a Comment