REST API Testing with Hoppscotch
Table of contents
No headings in the article.
Hoppscotch is light-weight, web based API development suite. It was built from ground up with ease of use and accessibility in mind providing all the functionality needed for API developers with minimalist, unobtrusive UI. It is free-to-use and as an added perk completely Open Source!
Creating collections
It is always a good practice to create a collection and add requests under the collection. To create a collection first click on Collections button and click on New button.
Give a suitable name for the collection and click Save.
The new collection created will be displayed under My Collections tab.
Adding first request under the Collection
In this blog I will be using REST apis provided by https://reqres.in/. I have used SINGLE USER api that supports http get method.
Copy the api end point and paste in hoppscotch. Before hitting the api save the api in the earlier created collection. For that click on the arrow button and click on Save as button.
Give a Request name, choose the desired collection in which you want to save the request and click Save button.
The new request will be displayed under the newly created collection.
Now click on the Send button and view the response from the api.
Creating environment and adding variables under it
Click on Environments button and click New button.
Add environment name and click Save
In order to add a variable click on the newly created environment and click on Add new button.
Add variable name and variable value. After that click on Save button.
Accessing environment variable
To access the environment variable use <<variable_name>>
object in request section and also make sure that the correct environment is selected from the top right corner for the request.
Now click Send and same result will be displayed as earlier.
Adding Tests(assertions) for the request
These are some of the tests performed on the response. More tests can be found from this link https://docs.hoppscotch.io/features/tests
Results of the tests will be displayed in the Test Results tab
If you need any clarifications regarding this post, please comment below the comment section.
If you are looking for any quality assurance service. Click below link.