JMeter – Posting JSON to API

Every time I have to get back to JMeter for load testing, I tend to forget the steps to setup my client. So this time taking notes so it saves me time in future.

1. Open a new instance of JMeter
2. Under Test Plan, add a HTTP Header Manager to set the content type by navigating to Test Plan > Add > Config Element > HTTP Header Manager. Add new value for Name = “Content-Type” and value = “application/json” (without quotes).
3. Under Test Plan, add a thread group by navigating to Test Plan > Add > Threads (Users) > Thread Group
4. Under Thread Group, add a sampler of type HTTP Request by navigating to Thread Group > Add > Sampler > HTTP Request
5. You can add various listeners to the Thread Group. I prefer Results in Table/Tree by navigating to Thread Group > Add > Listener > View Results in Table

JMeter Setup to POST JSON

Advertisements

5 thoughts on “JMeter – Posting JSON to API

  1. This post solved my problem of inability to set Content-Type to “application/xml” for POST request.

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