Apache JMeter is an open source load testing tool used to perform load test on web applications (client/server). JMeter is not a browser; rather, it’s purely a Java based application that works at the protocol level.

In order to check the performance of any web application, you need to first create a test plan consisting of the following elements:

  • Thread Group
  • Controllers
  • Samplers
  • Logic controllers
  • Test Fragments
  • Listeners
  • Timers
  • Assertions
  • Configuration elements
  • Pre-processor elements
  • Post-processor elements

After creating the test plan, you need to create the test scripts and run those scripts.

JMeter will execute the test plan elements in the following order:

  • Configuration elements
  • Pre-Processors
  • Timers
  • Sampler
  • Post-Processors (unless SampleResult is null)
  • Assertions (unless SampleResult is null)
  • Listeners (unless SampleResult is null)

While running the JMeter scripts, you might come across few common issues. Some of the commonly faced issues while using JMeter are discussed below.

Error 1: ‘error: jmeterjava.io.ioexception exceeded the maximum number of redirects XXX’

Solution: 

  1. Add the cache manager and cookie manager in your script.
  2. Alternatively, you can update the value of the line “# before httpsampler.max_redirects” to 20 and uncomment this section in the ‘jmeter.properties’ file. Then, restart JMeter.

Error 2:   While using a value with ‘,’ in it, but the system doesn’t pick values from normal CSV file.

Solution:

  1. Open the excel sheet, which will be used for the parameterization and enter values in cells.
  2. Save the file by selecting the option ‘Text (tab delimited)’ file format from save type option.
  3. A file will be created with .txt file extension.
  4. Now, go to the JMeter and paste the path of this .txt file in ‘Filename’ section of CSV data set config page.
  5. Then, add ‘/t’ in the Delimiter field displayed in JMeter CSV data set config page.
  6. After this, run your script and it will pick up the value having ‘,’.

Error 3:  “status”:401,”message”:”Unauthorized”

Solution:

In order to resolve the above issue, you will have to handle the value with a regular expression. You will need to add the regular expression in the HTTP header manager of any HTTP request.

  1. Open the HTTP header manager page of corresponding HTTP request in which you have to use the regular expression (Add ‘regex’ in the HTTP header manager in case there are no values in Parameters section of HTTP request).
  2. Click the ‘Add’ button.
  3. A row will be added.
  4. Now, enter the ‘Authorization’ and ‘Bearer ${regex}’ in the ‘Name and Value’ field respectively.
  5. Then, run the script and you will see it will pass.

Basics of JMeter and Troubleshooting

Error 4:  Issue in file uploads script while unloading the files

Solution: 

Normally, we add the file path in the ‘Send Files with the Requests’ section of the HTTP request samplers for the file upload. We put the file, which we have to upload via script anywhere on our system and specify the path in the ‘Send File with request’. However, at times this path doesn’t work. In such cases, you need to put the file in the ‘jmeter\apache-jmeter-2.9\bin’ folder of JMeter and should specify that path for the file upload in ‘Send File with request’ section. This would resolve the issue.