Postman is widely used tool for API testing . Testers discover endpoints, make requests, create test data, run regression testing, implement continuous integration of API testing by using Newman and much more. However, Postman has certain testing limitations. Developers, DevOps and QA engineers who want to gain more load testing abilities can convert their Postman tests to JMeter. This blog post will explain when it is recommended to convert Postman to JMeter, and a step by step explanation of how to do it.
Postman API Testing Limitations
Postman tests don’t scale. If you have many requests in your collection, Postman/Newman will be executing them with 1 thread (user) and sequentially, instead of with multiple threads and in parallel.
Performance Testing Capabilities
Postman is not suitable for API performance testing due to scalability limitations. Performance tests require running tests for multiple threads (users) at the same time, to check that your system doesn’t break under heavy loads.
After Converting Postman Tests to JMeter Tests
You may want to convert your existing Postman tests to JMeter to get the benefits of:
- Multithreaded execution
- Obtaining performance metrics for your API
- Getting advanced reporting and correlating increasing load with the increasing response time, number of errors, etc.
- Finding the bottlenecks and slowest API endpoints
1 – Setup JMeter for Recording
JMeter comes with an HTTP(S) Test Script Recorder that acts as a proxy for the browser (or any other application that uses the HTTP protocol and supports proxy). Therefore, you can use it for intercepting requests generated by the browser. In our case, you can use it to intercept Postman, and convert the requests to HTTP Request samplers.
JMeter configuration is fairly simple—especially if you use the JMeter Templates Feature:
1.Go to the JMeter main menu and choose File -> Templates -> Recording and click “Create”.
2.Select HTTP(S) Test Script Recorder and click “Start”.
3.Enter your API host so JMeter will put it under HTTP Request Defaults. For this demo we’ll use JMeter’s official website: https://jmeter.apache.org/.
2 – Setup Postman for Recording
1.First, import the JMeter certificate into Postman. When you launch JMeter’s HTTP(S) Test Script Recorder, JMeter generates a self-signed certificate that allows JMeter to decrypt HTTPS requests. The file is called ApacheJMeterTemporaryRootCA.crt and it will begin generating under the “bin” folder of your JMeter installation.
2. Open the Postman settings and to to “Certificates” tab
3.Toggle On for “CA certificates” and locate apacheJMeterTemporaryRootCA.crt. That’s it, now Postman will use JMeter’s certificate and JMeter will be able to decrypt captured requests.
Configure Postman to Use JMeter as Proxy
Now you need to “tell” Postman to send requests via JMeter’s HTTP(S) Test Script Recorder.
4. Go to Postman’s settings and open the “Proxy” tab.
5. Under Proxy configurations for sending requests tick “Add a custom proxy configuration” box.
6. Select both the “HTTP” and “HTTPS” protocols.
7. Use “localhost” as the proxy server (if you have JMeter running on the different host—use that host IP address or DNS hostname instead).
8. Use “8888” as the proxy port.
Step 3 – Record Tests
Congratulations! Postman and JMeter are finally connected. When you start your request or collection, JMeter will capture it and generate a HTTP Request sampler per request. If there are any HTTP Headers present JMeter will add a HTTP Header Manager to add the headers to the request.