Tactics to API Automation without programming

This is the step wise step guide for the API automation without using any programming language. It will run you through all the phase in API automation.

API automation can improve the depth and scope of the tests for better software quality.

Tools for API automation:

There is number of tools available in the market for the API testing and API automation, few are as follows:

Most of the companies opt the open-source tools as per the requirement. So, we are selecting here Postman which is open source and required no programming. It very easy to use. Postman provides a beautiful graphical user interface. Let’s know about the Postman.

Postman

Postman a chrome app is an API test tools which interact with HTTP, Https APIs. Postman is also used for the api automation with the silent feature pass data between requests, test suites, build requests with dynamic parameters, etc. It also validate the response  as per define script in the test after receiving the complete response message.

Most important feature of the postman is:

Requirement of Postman automation:

API automation is important for the software testing when a large no of Integrations and releases. The main aim for the API automation is reduce the large amount of effort required for manually re-testing of a software and removal of the manual testing effort for testing the functionalities of the product repeatedly. Postman is the best tool for the API testing and API automation.

API automation focuses on the small component of products and integration without any issue. API testing by pass actual graphical user interface and tends to be quicker and more maintainable and graphical user interface.

Thus, API automation becomes highly important when it automated all the testing process and save resources and valuable time.

Required tool for the API automation:

Following tools are required for the API automation.

Newman

Newman is the runner engine of the postman collection. It is similar to Postman command line interface. Newman runs the postman collection in following phases.

Newman can be integrated with the continuous integration system and build servers.

Advantages of Newman:

Newman makes easier to run the postman collection using command line.

Installation of required tool:

Postman:

Postman installation is very easy as like other software installation process. There is few steps as follows:

Node:

Node installation is also like above installation process.

Steps are as follows:

After the above steps, make sure the Node is successfully installed by running the following commands.

Newman:

Newman installation is little different from the other software. Newman is installed through npm package by running the following command.

Refer the below screenshot:

Create test script using Postman:

Postman provides Graphical User Interface in for creating test scripts. Steps are as follows:

Example of some test:

Test name Test scripts
Verify the status code tests[“Status code is 200”] = responseCode.code === 200;
Verify the String in the response tests[“Body matches string”] = responseBody.has(“gob”);
Verify the JSON Data var jsonData=JSON.parse(responseBody); tests[“Response should have id of gob as 5: ” ] = jsonData.data[1].id === 5; tests[“Response should have last name of gob as bluth” ] = jsonData.data[1].last_name === “bluth”;
Check the response time tests[“Response time is less than 200ms”] = responseTime < 200;

 Variable:

In the postman, we can define the variables. There are two types of variables Environment and Global.

Environment variable is defined for the specific for set of collection as per the environment which can be selected or no environment is selected.

Global variable are defined for all the collection. Variables are accessed in the request with surrounded by the curly brackets: {{VARIABLE_NAME}}.

Define variable:

 To create environment variable in the postman.

Thus, we can declare environment variable in the postman and use in the specific collection.

Similarly, to create global variable in the postman.

Thus, we can declare Global variable in the postman and use in the specific collection.

As above we have created the collection with some request with some test scripts.

API Automation using collection runner

Collection runner is the graphical user interface to run the collection which contains the set API requests with test scripts.

Steps:

Observe the result.

API Automation using Newman

As above we have gone through the introduction of Newman. Newman is a command line interface for postman collection runner. Above

Steps:

Observe the result.

This is Command line interface is compatible to integrate Continuous Integration tools. with build tools like Jenkins.

Advantages of Postman:

Author : Rahul Kumar

SHARE THIS

Get A Free Quote

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.