Automation & Record Keeping Using Postman

Automation & Record Keeping Using Postman
COMMENTS ()
Tweet

 

 

What is Postman, and why use it?

Postman is an API Development Environment that helps people to build, test, document, monitor and publish documentation for their APIs.

Postman is used by 6 million developers and more than 200,000 companies to access 130 million APIs every month. API testing is likely to grow further in 2019 so knowing how to use Postman effectively will be a powerful asset.

Imgur HarperDB published their API documentation using postman.

Here’s what you need to know about your Postman:

Automation_Documentation_Using_Postman_Blog_folio3

What is the goal?

Testing APIs is often slow, error-prone and annoying. Instead of manually checking an endpoint’s response, we can write integration tests with Postman to examine and validate the response. We also want to automate running these tests with our deployment process. One approach you can take is to have your integration tests run every time a developer checks in code to your repo.

Rapid feedback!

Why do we want to do this?

Automate your QA and Testing processes! While this is in the right direction, this doesn’t fool proof. This adds another layer of quality control but we need to ensure our tests are thorough and up to date.

The idea is to ensure existing functionality still works as expected when we add new features to our API. Having this process automated, will identify unexpected issues early in the development life cycle and will help the developers evaluate their code.

Let’s get familiar with the features which are commonly used

 

 

Newman

Newman is Postman’s collection runner engine that sends API requests, receives the response and then runs your test against the response. It is extensible and so can be integrated into continuous integration servers and build systems.

Automation_Documentation_Using_Postman_Blog_folio3

Runner

Postman’s Collection Runner lets you run all the requests inside a collection locally in the Postman app. It also generates reports so that you can measure the performance of your tests.

Automation_Documentation_Using_Postman_Blog_folio3

 

 

Variables

Two main types of variables – global and environment. Global variables are for all Collections, whereas the environment variables are defined for a specific set of collections

Click on Manage Environment Setting & You can create a new environment

Automation_Documentation_Using_Postman_Blog_folio3

Click on Manage Environment Setting -> Click on Global Button  & You can create a new global variable.

Automation_Documentation_Using_Postman_Blog_folio3

 

 

Scripts

Postman allows users to perform specific JavaScript coding to manipulate the data being sent along with the request. We can write these scripts in Tests section and prerequisite section. We can set Global and Environment Variable dynamically as well.

Automation_Documentation_Using_Postman_Blog_folio3

postman.setGlobalVariable(“Token”, “xyzToken”);
postman.setEnvironmentVariable(“Username”, “myUserName”);
postman.getGlobalVariable(“Username”); 

 

 

Console

Postman Console is analogous to a browser’s developer console, except that it’s tuned for API development. If an API or API test is not behaving as you expect, this would be the place where you will go to deep dive while debugging.

Automation_Documentation_Using_Postman_Blog_folio3

 

For API automation using POSTMAN, we need to adopt the following step(s)

    • Recognize common values in every API
      • Store values in Global and Environment variables
      • Pass the variables rather than passing value manually/hardcoded

 

    • Identify manual values that need to be changed before hitting the API
      • Replace each value with dynamic variable
        • {{$guid}} : Adds a v4 style guid
        • {{$timestamp}}: Adds the current timestamp
        • {{$randomInt}}: Adds a random integer between 0 and 1000

 

    • Dependency of any API to other API?
      • Order your request accordingly (REST queries from top to bottom)

 

API documentation

Postman’s API Documentation feature lets you view private API documentation or share public API documentation in a beautifully formatted web page.

What gets automatically generated?

Documentation for your API includes:

              • Sample requests, headers, and other metadata
              • Descriptions associated with requests, folders, and collections
              • Generated code snippets in some of the most popular programming languages
              • You can customize descriptions using Markdown styling with embedded graphics to complement your documentation.
              • Adding comments to the endpoints as shown in image below

What you can do manually?

Automation_Documentation_Using_Postman_Blog_folio3
Finally click ellipses (…) in the sidebar and select ‘Publish Docs’, as illustrated below:

Automation_Documentation_Using_Postman_Blog_folio3

 

Please feel free to reach out if you have any questions. In case you need any help with development, installation, integration, up-gradation and customization of your Business Solutions. We have expertise in Enterprise Application Development Solutions. Connect with us for more information. [email protected]

CALL

USA408 365 4638

VISIT

1301 Shoreway Road, Suite 160,

Belmont, CA 94002

Contact us

Whether you are a large enterprise looking to augment your teams with experts resources or an SME looking to scale your business or a startup looking to build something.
We are your digital growth partner.

Tel: +1 408 365 4638
Support: +1 (408) 512 1812