DEV Community

Cyril George
Cyril George

Posted on • Edited on

Api Testing with Hoppscotch

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.
Creating collection
Give a suitable name for the collection and click Save.
Collection name
The new collection created will be displayed under My Collections tab.
Collection created
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.
Reqres
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.
Adding request in hoppscotch
Give a Request name, choose the desired collection in which you want to save the request and click Save button.
Request name
The new request will be displayed under the newly created collection.
Request created
Now click on the Send button and view the response from the api.
Response of api
Creating environment and adding variables under it
Click on Environments button and click New button.
Adding environment
Add environment name and click Save
Add environment name
In order to add a variable click on the newly created environment and click on Add new button.
Add variable
Add variable name and variable value. After that click on Save button.
Add variable for environment
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.
Accessing env variable
Now click Send and same result will be displayed as earlier.
Sending request
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
Adding tests
Results of the tests will be displayed in the Test Results tab
Tests results
If you need any clarifications regarding this post, please comment below the comment section.

Top comments (0)