Performance Testing with Postman

By | 2018-11-23T00:49:11+00:00 November 23rd, 2018|

Postman is an open source API testing tool. It can work with any given endpoint even if it’s Restful or XML based. It has an easy to use interface to make the request to the given endpoints. It offers a rich variety of features. Creating a collection from requests, extracting data from any response and storing in a variable are the least you can do with Postman.

Postman supports any HTTP request type like the POST, PUT, GET, etc. Let’s see what the key features of a POSTMAN request are. Postman request consists of 5 different sections

Authorization

The endpoint might work with or without authorization. That’s why Postman supports OAuth 1.0, OAuth 2.0, Basic Auth etc as an authorization mechanism. For example, in case you need to use your AWS Signature; you can choose AWS Signature from Authorization. Then you just type your AWS region, server name, credentials and you are ready to use it.

Headers

Header refers to supplemental data placed at the beginning of a transmitted block of data. Data following the header are sometimes called the payload or body. They define the operating parameters of an HTTP transaction. In case they are not defined properly, a server cannot handle the request properly and it can lead to a failure.

Some basic headers are

  • Content-Type,
  • Accept-Encoding,
  • Authorization.

Those headers change according to your endpoint’s implementation.

Body

The body represents the data to be sent to the server. It can be a plain text, JSON, XML object or a file.

Pre Request Script

This section runs before any request is made. It supports Javascript and does whatever you want like creating a variable, reading some values from a file,etc.. Consider this as the pre-processor in JMeter.

Test

This section runs after a request is made. It’s not easy to check the response manually so you might want to do some validation against the response automatically. That section allows you to write some javascript code to do those operations.

But where does Postman comes into Software development lifecycle? During the development process, there’s always a delay between the front end or back-end development. Aligning those teams are challenging. To make QA and Front-end developers’ lives easier Postman provides a Mock Service feature to simulate the backend server.  So you can simulate each endpoint in a Postman Collection to view the potential responses, without actually reaching the back end.

All those things make QA engineers’ life easier when it comes to manual testing. But what about test automation? Is it possible to automate Postman script’s execution?

Postman has a great command line tool. It’s called Newman. It can run all those tests by a simple command and you can schedule it with some cron jobs. You might also want to use Jenkins CI to trigger it.

But what about performance testing? When you have a Postman collection having hundreds of requests, it’s not easy to convert it to a JMeter script. Copying and pasting is overwhelming. That’s where Loadium comes into play. We offer Postman users a JMeter converter tool. You can export your Postman v2.0 collections and upload it into our system (https://loadium.com/postman-to-jmeter-converter/) then receive the JMeter file. By the way, we don’t store your collections for security purposes.

Converter creates one HTTP Samplers for a request in Postman. In case there’s a body or headers, it sets them accordingly.

Example Postmand Request

Converted JMeter Sampler

Example Postmand Request Header

Converted JMeter HTTP Sampler Header

But of course, there are some limitations.

Limitations:

  • Loadium cannot convert Pre-request Script and Test features of a request. You need to manually configure them according to your need.
  • As Postman Collection files don’t store environment variables in the exported JSON file. That’s why Loadium will create JMeter variables so you’ll know which variable to add.

Now, whenever you need to work on a performance testing project, you can simply convert your postman scripts into a JMeter file and create heavy load into your applications.

Happy testing!