BugRaptors

Services

  • Manual Testing
  • Automation Testing
  • Performance Testing
  • Security Testing
  • Web Testing
  • Mobile Testing
  • AI Testing

Solutions

  • BugBot
  • MoboRaptors
  • RaptorVista

Resources

  • Blogs
  • Case Studies
  • Client Testimonials
  • Ebooks
  • News

More Info

  • Contact Us
  • Privacy Policy
  • Terms and Conditions
  • Careers
  • FAQ
  • Sitemap

Subscribe to our Blogs

Copyright ©BugRaptorsAll rights reserved.

Branding Partner: Make My Brand
Bugraptor logo
Bugraptor logo
Company
AI-Enhanced Engineering Solutions
QA Offerings
Verticals
Tools
Resources
Bugraptor logo
Company
Preparing menu...
AI-Enhanced Engineering Solutions
Preparing menu...
QA Offerings
Preparing menu...
Verticals
Preparing menu...
Tools
Preparing menu...
Resources
Preparing menu...

We use cookies to improve your experience. By using our site, you agree to our cookie policy.

Back to Articles

Jul 31, 2020

Test Automation Of APIs Using Postman

1197 views
4 min read
Add Us as Your Preferred Source
Test Automation Of APIs Using Postman

API is Application Programming Interface. It is used to establish communication and data exchange between two software systems. A software system implementing an API consists of various functions and sub-routines which can be executed by another software system. API testing is totally different from GUI testing. It basically concentrates on the business logic layer of the software architecture. In API Testing, you use software to send calls to the API, get output, and note down the system's response.

API Architecture

API calls collection includes mainly two things:

1. HTTP headers: HTTP headers are always dependent on your application.

i) Authorization: A token included with requests to identify the requester. This header has to be included in all requests other than the login request.

ii) Content-Type: A standard MIME type describes the format of object data.
Content type in most of the requests and responses will be application/json.

2. HTTP Request: There are mainly four types of requests.

i) POST– Used to Create or Update data

ii) PUT- Used to Update data

iii) GET- Used to Retrieve data

iv) DELETE– Used to Delete data

What is Postman?

Postman is used to fire requests to an API. It is available as add-in on Chrome and also available for Mac application.  It is very fast in response and also light weight which puts no impact on browser performance. Tests can be created with verifications for certain conditions on the response. With Postman, you can create different kinds of HTTP requests such as GET, POST, PUT, PATCH and DELETE. It also provides supports for adding headers in the requests. It’s a very convenient API tool with very useful features.

How To Perform Automation Testing of APIs Using Postman?

Following criteria detailing the process, to perform automation software testing of APIs by using Postman:

* First, install ‘POSTMAN’ add on in Google Chrome.

* Open Postman.

* Click on ‘Create New Collection’ button, fill details and Click ‘Create’ button.

* Now go to newly created Collection and Create New Folder by selecting ‘Add Folder’ option of side menu bar.

* Now Click ‘+’ Button for opening new Tab.

* Now Fill URL, headers, Select Method (Get/POST/PATCH etc.), Body etc. and click ‘Send’. It will show the result in a response. It should return desired results. If there is a problem Please recheck every prerequisites and requirement.

* You can add desired assertions in a particular request in tests tab like:

           tests[“Check: Status code is 201”] = responseCode.code === 201;

* Now ‘Save as’ request by filling its Name, Folder Name, Description etc. It will show the request under your selected Folder/Collection.

* Now Click on Setting Environment Button (Setting Icon on Top right corner under Heart Icon) and select ‘Manage Environments’.

* Click on ‘Add’ Button, Enter Name for environments, Enter Keys and Values. Keys(Name of the variable like URL), Value(Value of Variable like: http://bugraptors.com/). Click ‘Add’. It will create environments.

* Now select newly created environments from DDL (Top right corner with setting Icon).

* Now use the variable as a requirement. Syntax to use is {{Key of variable}}.Like: {{URL}}. It will show variables in a list and you can select from there too. If the variable is accessible it will automatically convert it into orange color either it will reflect in Red color.

* Do the same process for all your APIs.

* Now you can run the whole collection or single folder by Clicking on ‘Runner’ (Top Left corner Button) or Click run from the submenu of the desired collection. It will open Runner Window. Select Collection/Folder, Select required environments, Fill iteration count (If you want to run it multiple times), Fill Delay, Choose Data File if required, and click ‘Start Test’. It will Give you result of every request.

* You can fetch Data from the response of a particular request and store that in variables. The syntax of it is like:

           var jsonData = JSON.parse(responseBody);

           postman.setEnvironmentVariable(“variable_key”, “variable_value”);

* For ‘report’ you have to install ‘Newman’ on your PC. It is command line tool that can generate the report by running POSTMAN collections.

* Now export Postman Collection by selecting Export from the left menu bar of the desired collection.

* Also, export the required environments on manage environments window from download icon button.

Interested in Our QA Services?

Get in touch with us to discuss your requirements

Interested in our QA services?

← View All Articles

Recent Articles

Explore more insights and articles from our experts

BugRaptors is one of the best software testing companies headquartered in India and the US, which is committed to catering to the diverse QA needs of any business. We are one of the fastest-growing QA companies; striving to deliver technology-oriented QA services, worldwide. BugRaptors is a team of 200+ ISTQB-certified testers, along with ISO 9001:2018 and ISO 27001 certifications.

flag

Corporate Office - USA

5858 Horton Street, Suite 101, Emeryville, CA 94608, United States
+1 (510) 371-9104
flag

Test Labs - India

2nd Floor, C-136, Industrial Area, Phase - 8, Mohali - 160071, Punjab, India
+91 77173-00289
flag

Corporate Office - India

52, First Floor, Sec-71, Mohali, PB 160071, India
flag

United Kingdom

97 Hackney Rd London E2 8ET
flag

Australia

Suite 4004, 11 Hassal St Parramatta NSW 2150
flag

UAE

Meydan Grandstand, 6th floor, Meydan Road, Nad Al Sheba, Dubai, U.A.E

Interested in our QA services?