Howto debug JMeter scripts

In this article we examine debugging options in JMeter. I start from debugging on GUI level which helps during working with “Post Processors”. In this case we will debug “Regular Expression Extractor”. To make it work, add these elements into test tree:

    • Thread group
      • HTTP Request
        • Regular Expression Extractor
      • Debug Sampler
      • View Results Tree

Now you have to configure “HTTP Request” and “Regular Expression Extractor” and the rest of elements leave unchanged. Insert any server name, for example in “HTTP Request”. “Regular Expression Extractor” should be changed proceeding screenshot.


Now try to run your test, open “View Results Tree” and select “Debug Sampler”. On the right pane you see the list of Jmeter variables and also REGEXP variable with value.


Tips to debug manually with Debug Sampler

  • Disable all unused elements in test tree, as it will take too much time
  • Set all Thread properties values to 1
  • Click Ctrl+E and Ctrl+R – to keep results tree clean

Jmeter Debug logging

 Debug logging can provide more detailed information. By default you can debug any package and any class. So I showed howto debug “Regular Expression Extractor” with Debug Sampler and now I will show howto debug “Regular Expression Extractor” with debug logging. First you need change and set jmeter.loggerpanel.display=true. After save your script and restart Jmeter. When Jmeter launches you will see log panel.


Open your previous script, select “Regular Expression Extractor” from test tree and click Ctrl+W. In log panel you see two new strings, this is classpath of “Regular Expression Extractor” processor.


 Now open and add line in “Logging Configuration” label:


Restart Jmeter, open your script and try to run it. If you see DEBUG – jmeter.extractor.RegexExtractor message this means debug logging working and you can scroll up to see HTML body, “Regular Expression Extractor” settings.


It’s not recommended to use such way to debug Regexp patterns, it was just example. But debugging protocols such as HTTP, FTP, JDBC, JAVA wil be very useful, to achieve this just uncomment needed packages in and change value to DEBUG. For example:


Howto debug Beanshell in Jmeter

When you use Beanshell in your script it maybe difficult to debug it in Jmeter. You can enable Beanshell debug logging with adding log_level.jmeter.testbeans=DEBUG in

As result you will get detailed debug information but Jmeter is not IDE and sure not good choice for debugging Beanshell scripts. I decided that best option to debug Beanshell is using native console in standalone mode. Let’s create simple beanshell and lauch it.

$vim helloWorld.bsh

Add this code:

helloWorld() {

System.out.println("Hello World!");


Export Beanshell classpath to use it in console.

export CLASSPATH=$CLASSPATH:bsh-xx.jar

bsh-xx.jar can be found in lib folder of Jmeter.

Run your script:

java bsh.Interpreter helloWorld.bsh

If you get error similar to this:

Evaluation Error: Sourced file: helloWorld.bsh Token Parsing Error: Lexical error at line 5, column 24. Encountered: "u201c" (8220), after : "":

To fix it change curly quote to simple.

To debug this code add to the first line code:


and you code will look like this:

helloWorld() {    System.out.println("Hello World!");

Run your code:

 bsh.Interpreter helloWorld.bsh


// Debug: invokeLocalMethod: helloWorld
// Debug: trying to resolve variable: System
// Debug: trying class: System.out
// Debug: Trying to load class: System
// Debug: getClass(): System not	found in NameSpace: helloWorld (bsh.NameSpace@771c8a71) (method) 
// Debug: Trying to load class: java.lang.System
// Debug: Name call to getStaticFieldValue, class: class java.lang.System, field:out
// Debug: getResolvedMethod cache MISS: class - println
// Debug: Searching for method: println( java.lang.String ) in ''
// Debug: Looking for most specific method: println
// Debug: cacheResolvedMethod putting: class public void
// Debug: Invoking method (entry): public void with args:
// Debug: args[0] = Hello World! type = class java.lang.String
// Debug: Invoking method (after massaging values): public void with args:
// Debug: args[0] = Hello World! type = class java.lang.String
Hello World!
// Debug: End of File!

2 thoughts on “Howto debug JMeter scripts

  1. Pingback: Debugging JMeter with Wireshark | Release/QA/Project Management

  2. Pingback: Using Beanshell for Beginners | Release/QA/Project Management

Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s