info@pragmatictesters.com +94 11 253 8512

Debugging is the process of identifying the finding and resolving the bugs in the JMeter scripts and configurations. There are a number of methods, techniques and tools available for JMeter test engineers for debugging.

Learning the debugging techniques would definitely help you to identify the issues/bugs quickly.

In this article you will learn ten different ways for debugging.

1. JMeter.log file

JMeter logs the events into the jmeter.log file located in the JMETER_HOME/bin folder. The logging can be configured through the log4j.xml file located in the JMETER_HOME/bin.

You may set  the logging level to INFO/DEBUG in log4j.xml  during the debugging and user ERROR during the load testing to minimize the resource consumption.
Learning log4j will be useful if you are looking for advanced debugging.

2. Log Viewer Panel

You can view the log entries through the log viewer panel available in the JMeter IDE. The panel can be launched/closed by clicking either  Options → Log Viewer menu item or by clicking the icon in the top right corner. 

The log levels can be set through the Options→ Log Level menu item. The setting is immediately effective for subsequent log entries.  
The log panel can be cleared by clicking the Run → Clear All menu item or by clicking the Clear All icon in the top of the tool bar. The log entries will not be deleted from the jmeter.log files.

3. Blazemeter Step-by-Step Debugger

You can do step by step debugging in JMeter with the Blazemeter Step-by-Step debugger plugin. The plugin through the JMeter plugins manager.  Once the installation is done you have access to the following features.

  • Step over single component
  • Breakpoints and running until paused
  • Current values for variables and properties shown
  • Evaluate expressions panel
  • Resolved execution tree displayed
  • Current element and current sampler scope highlighted in the tree
  • Element UI shown with resolved variables and functions

4. Debug Post Processor

Debug post processor creates sub samplers with the details of the 

  • Previous Sampler properties 
  • JMeter variables 
  • JMeter properties 
  • System properties 

You can configure what you want to see in the response data tab of the sub sampler.

Set the flag to false if the details are not required to make the response easy to read.

5. Debug Sampler 

Debug sampler generate a sample result with all

  • System properties 
  • JMeter properties 
  • JMeter variables 

Place the Debug sample in the test plan where you need to evaluate the details. Set the flags true/false as per your requirement.

6. Writing to the console

You can print custom information (data, ,messages etc) to the console from elements with programmable interfaces. JSR223 elements (Sampler, Per/Post processor, assertion etc) are preferred. 

All the elements give access to a variable OUT , which is equivalent to the System.out

Hence if you want to write a message (or variables) use following syntax 

OUT.println(“My message”)

OUT.print(“My message”)

You can log messages to jmeter.log and log viewer panel from the elements with programmable interfaces. Use the variable log with the log level (info, error, warn, debug etc) to log the messages.

log.info (“Contact id ” + contactId)

7. Using Fiddler Proxy

You can view the actual requests sent from JMeter to the application by sending the requests trough Fiddler proxy. This method will be useful when you want to check the actual responses sent by Jmeter, specially when there is a bug in JMeter.

Using JMeter behind a proxy

jmeter -H localhost 127.0.0.1 -P 8888 

8. Using Dummy Sampler

Sometimes you will have to verify the script behaviour for certain requests/responses but it’s harder to reproduce them at the time of scripting. For example to verify the regular expressions against certain response data.

Dummy sampler plugin  will help you to set the sampler details as per our requirement. Response code, response message, request/response body, connect time, latency etc.
Java Sampler available out of the box with JMeter provides similar functionality.

9. Saving Response to File

If the responses are larger than 200K, you may save the responses to a file for analysing the details.  You can use the Save Response to a File listener to save the entire response. 
Note : You need to ensure the listener is disabled during load testing as it will consume a lot of available space from your storage.

10. View Result Tree

You can analyse the details of the request and responses through the view results tree listener. You can select a result from the left pane and analyse the details.

You can search all requests through the search interface. 

Searching individual results is possible through the individual result window 

You can view the data in different supported format by selecting the appropriate item from the dropdown (Text, JSON, HTML , XML etc) .

JSON, XPath, CSS and Regular expressions can be verified against the sample responses before using them in post processors. 

The responses saved into XML format can be loaded into the view results tree and analyse the details later too.

The view result tree can be used to analyse the content of request and response body/header details. 

Author: Janesh Kodikara

Performance Tester | JMeter Trainer | Software Testing Service Provider

Your Turn To Talk

Leave a reply:

Your email address will not be published.