Codeless API Automation and Monitoring System using Postman

Shiksha Engineering
6 min readDec 2, 2020

Author : Vidushi Bhadola

(Image Credits : www.srijan.net)

Postman is a collaboration platform for API development and testing. It provides a simple UI interface where one can directly hit API requests and gather responses and run various tests on the response of the API. In the scope of testing, Postman can be used for Automated Testing as well as Exploratory Testing.

CURRENT PROBLEMS FACED BY QA ENGINEERS

  1. QA Team spends a considerable amount of time and effort in creating automation scripts for APIs using Rest Assured
  2. Using Rest Assured, there is no one stop destination for API information i.e. what kind of Request Body, Request Headers etc are needed to successfully run the API, are not readily available to the team
  3. In the process of automating APIs via Rest Assured, the QA team first tests the API manually using Postman and then automates the API using Rest Assured.

HOW DOES POSTMAN SOLVE THESE PROBLEMS?

  1. Postman offers a simple user-friendly interface where the user just needs to enter the request URL, fill in the necessary headers and body, select the HTTP method, and hit the ‘send’ button as opposed to Rest-assured where user has to have an in-depth knowledge of programming.
  2. Postman provides a collection feature which is used to group multiple APIs under a single collection head and can also be saved for future reference. No such functionality is provided in Rest Assured.
  3. In rest assured, one has to write code for each and every API to be automated separately. Under postman, one has to write only minimal code for all APIs.
  4. With Postman, we can automate the APIs along with manual testing of the same using the Export feature of Collections. In the rest-assured model, one has to first complete manual testing of the API after which (s)he will write the code for the same.

To learn more about Postman’s Advanced Features, refer to this blog : https://shiksha-com.medium.com/advanced-features-of-postman-9a3d33fe041

Codeless API Automation and Monitoring System using Postman

The Codeless API automation and Monitoring System is a project undertaken by the QA Team at Shiksha to automate APIs using Postman instead of Rest Assured.

Technology Stack used -

  1. Postman — Postman is a collaboration platform for API development. Postman enables exploration and testing of APIs. We have used the Collections and the Export feature of Postman in our project.
  2. Newman — Newman is a command line Collection Runner for Postman. We have used it to run Postman Collection directly from a Jenkins Build
  3. Apache Drill — Apache Drill framework is an open source SQL query engine for Big Data exploration which we have used for reading database via Postman
  4. HTML/CSS — HTML and CSS are used to define the front-end of web pages. In our case, they are used to define front end of our dashboard
  5. Servlet — Servlets are the Java programs that run on the Java-enabled web server or application server and handle the request obtained from the web server. In our project, it is used to serve the backend data of our dashboard.

HOW WAS THIS ACHIEVED?

The Shiksha QA Team built the system in the below manner :

Step 1 : Making Collections in Postman

For each internal Shiksha Team, QA made team-wise API collections which contained various APIs used by each team. All API information including Request Headers, Request Body, Assertions etc were stored in the collections. Using the Export Feature of Postman, these were then exported into a GIT project in the form of JSON files.

Step 2 : Installing Newman and Apache Drill

Then, we installed Newman and Apache Drill on the system on which the GIT project was to be run. Newman is used to run Postman from the Command Line. Since end-to-end testing is incomplete without DB Validations, Apache Drill is installed to make DB connections in Postman.

Step 3 : Running build via Jenkins pipeline

Then, we integrated our project into a Jenkins pipeline to schedule the project to run everyday. On running the Jenkins Build, a Newman report is generated which contains details of all the APIs present in the collections.

Step 4 : Inserting collection data and historical data in database

We then stored the collection data in a My SQL database to access the information over time. And with each build, we generated Historical data to show in a dashboard format for easier access.

Step 5 : Viewing the data in an API Monitoring dashboard

Then we created an API Monitoring dashboard for easier access to all stakeholders. The dashboard provides a high-level view of the Collections that are run and in the second level of dashboard, one can access the Newman generated report for each day.

Fig. Steps

API Monitoring Dashboard

An API monitoring dashboard was created to showcase the results of the above steps in a comprehensible manner.

The first view of the dashboard shows team-wise names -

Fig. First View of Dashboard

On clicking the name of a particular team, the Collection list of that team can be seen along with the number of APIs in the collection, time taken to run the collection and pass and fail rate of the collections.

Fig. Second View of Dashboard

On clicking on a particular collection name, a detailed list of each API of that collection can be seen which contains Response Time, Response Status code etc of each API of the collection as shown in below Fig.

Fig. Last detailed view of dashboard

On clicking an API in the above list, we can see the Newman generated report of that API -

Fig. Newman Dashboard

Benefits reaped from this project

API Automation via Postman provides the following benefits to the Shiksha QA Team -

  • Automated HTML report is generated
  • Unique dashboard for easier access is available
  • All API information is readily available in one place
  • Continuous tracking of API failure is done
  • Historical trends are available

Other Blogs in this series -

Advanced Features of Postman :

Postman is a powerful tool used to test web services. It offers a simple user-friendly interface. List of various advanced features of postman -

  • Collection runner
  • Data Driven Testing in collection
  • Global Variables
  • Assertions

To learn more about these features, refer here.

Apache Drill for DB Connection in Postman :

Looking into building up an end to end solution for API testing. Postman being a rest client not a DB client was a big challenge. So we need a Middle ware to communicate from Postman to DB directly. So this can be resolved using the open source SQL query engine Apache Drill. To learn more about this, refer here.

Newman :

Newman is a command line Collection Runner for Postman. It allows you to run and test a Postman Collection directly from the command line. To read more about Newman refer here.

--

--