Debugging JMeter with Wireshark

In this post, we consider the situation when JMeter request which was recorded with “HTTP(S) Test Script Recorder” does not work but if you repeat steps with browser everything works fine and if you have already tried to debug JMeter script but with no results. In more detail, you recorded HTTP request which should check some sort of API action but when run JMeter script occurring error. API, in turn, didn’t return accurate information about the error. If you try to repeat the steps using a browser then everything works fine. The first thing that may come to mind it so HTTP Cookie Manager, but if after adding HTTP Cookie Manager error persists then have to use Wireshark to see what is wrong. So, open Wireshark, select the network interface if you do not know what interface to choose, choose “any”.

screenshot_533

Now run sniffing and write in the box Filter:

http.request.method == "DELETE"

Instead of “DELETE” you can assign “GET”, “POST”, “PUT” according to the method.

screenshot_532

After that, open the browser and perform the steps that we need, if the connection between the browser and the server is encrypted you’ll have to decrypt Wireshark packets, but if not then you will see the requests sent. Now you need to save them in a text format, for this select “File” -> “Export” -> “as ‘Plain Text’ file …”. In the new window, select “All expanded”, “Displayed”, insert the name of the file. After that, we need to repeat the previous steps, but only need to capture requests through JMeter. After that, you will have two files with captured packets. Now run or install program Meld:

sudo apt-get install meld

Open the program and select two captured files to compare them.

 

screenshot_535After analyzing two files figured out that there was no “Content-Type” header in request and this was causing problem. Adding “Content-Type” header solved the problem. That’s it!

 

Interested in our services? Get a free quote! Contact us!

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