Use Postman to Hammer a REST API

TL;DR: I had no idea you could run multiple instances of the Postman Collection Runner. This is a useful tool for sending buttloads of requests to a web service.

Recently, I needed an artificial way to test a local instance of a Spring Boot app with a flood of requests.

First, I set up a Postman request with some simple tests. One way to ascertain if the service is screwed up is to analyze a specific response header. I wrote a request with 2 tests, one to verify the response body and one to verify the header. I created a collection with this single request, then set up a Postman Collection Runner to run it against a local instance of the app.

Screen Shot 2017-03-14 at 2.43.10 PM

Running just one Collection Runner did not produce any failures, even with 50, 100, 200 iterations.  It looked like these requests are sent in series, which didn’t seem to be fast enough to freak out the app. Eventually, it occurred to me to click “Runner” to spawn a new instance of the Collection Runner. Eureka! I spawned 6 instances of the runner, with 50 tests each, and started them up as fast as I could click. Finally, this produced some failures! Several more runs produced similar results. This indicated app was was failing when stressed.

Screen Shot 2017-03-14 at 6.18.39 PM (2)

After reviewing some details in the Postman console, and the log file directly, I could identify some likely culprits in the code and do some fixin’. The results I got with Postman gave me concrete evidence of an issue, in a controlled local environment. Furthermore, I now have repeatable tests to use as I work through the issue. The next obvious step is to automate these requests… TO BE CONTINUED.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s