Getting started with postman - Writing your first test

ยท

3 min read

Getting started with postman - Writing your first test

After my last article on how to generate a Newman report for postman
I got a request to write about how to install postman and write a test. I also figured a lot of beginners would find this really useful.

A little background info, Postman is one of the most popular platforms used by developers for building and testing APIs, they have an estimated number of 7 million active users and 75,000 public APIs. In this tutorial, I would be explaining how to use postman as an HTTP client to test HTTP requests for different types of responses.

Postman Installation

You need to install postman on your computer.

  1. Download the postman app by clicking here
  2. Click on the download option as it depends on your operating system (mac, windows, or Linux) image.png
  3. Install the downloaded zip file

    please note that for mac you need to move the zip file to your applications folder.

Your postman screen should look like this after signing up for a postman account Screenshot 2022-04-30 at 18.36.02.png Weldone! you have successfully downloaded postman.

Now let's run a simple GET and POST request on postman

Sample GET request endpoint - gorest.co.in/public/v2/users

  1. Navigate to your postman and click on create new HTTP GET request

    The GET request is used to retrieve data from a database without making changes. Screenshot 2022-04-30 at 19.02.25.png

  2. Add your endpoint URL and API path [gorest.co.in/public/v2/users] Screenshot 2022-04-30 at 20.14.09.png
  3. Click on send to get a response from the endpoint as shown below Screenshot 2022-04-30 at 20.13.29.png

The endpoint will return a list of record that has been stored in the database.

Let's run a POST HTTP request endpoint

A POST request is used to create a resource in the database by making API calls Sample endpoint - reqres.in/api/users

  1. Open a new request tab
  2. Follow the same instructions as above but this time you need to change your request method (POST).
  3. Since we are running a POST, we also need to add a request body of the data we want to create in the database.

Screen Shot 2022-07-08 at 15.20.09.png

  1. Click on send to get a response from the endpoint as shown below.

Screen Shot 2022-07-08 at 15.21.11.png

The endpoint returned a response body that shows a record has been created with an HTTP status code of 201.

Hooray!!! ๐Ÿฅณ you've run your first test.

You can visit this free REST API website to test for more HTTP methods and scenarios on postman.

Don't forget to like and follow my blog if you find this useful and also drop your comments ๐Ÿ™