Refael Botbol is the Director of Professional Services for BlazeMeter and manages the delivery of BlazeMeter’s Enterprise projects. He has nearly 15 years of end-to-end experience, ranging from development and system engineering up to customer-facing positions. His proficiency includes operating systems and performance testing, leading multiple web-based platforms projects, including technologies such as Apache, JBoss, Microsoft IIS, IBM WebSphere, and complete deployment in enterprises including high familiarity with implementation needs.

Learn JMeter in 5 Hours

Start Learning
Slack

Test Your Website Performance NOW!

Jun 07 2016

A Step-by-Step Debugger for JMeter - It’s Not a Dream Anymore

We’ve covered before various ways to debug scripts in JMeter, but now you have the ability to debug scripts step-by-step and receive updates in real time. Here’s how.

 

Exit Complexity, Enter Simplicity

 

When I started to work with JMeter to create scripts, I was (as I’m sure we all do) feeling like debugging my scripts was way too cumbersome a process. By using the Debug Sampler, and log() functions, it really felt like the old Mainframe debugging days.

 

I wished we could just have a normal step-by-step debug, just like any normal IDE (Integrated development environment), to debug my scripts and find issues.

 

Now, because of BlazeMeter, that day has finally come! BlazeMeter has created a step-by-step debugger, and here is how to get it:

 

By using the Plugin Manager (you don’t have it yet ?!) you can get the step-by-step debugger with just 4 easy steps:

 

 

  1. Open JMeter and go to the Options->Plugin Manager
  2. Switch to “Available Plugins” tab
  3. Select the “BlazeMeter Step-by-Step Debugger”
  4. Click “Apply Changes and Restart JMeter”

 

Once JMeter will relaunch itself, you should see the debugger plugin under “Installed plugins”. 

 

JMeter Step-by-Step Debugger

 

Now, let’s go for a short tour about how to use it. For that, I’ve prepared a JMX file (attached) as an example, in order to show you how to use the debugger features.

 

Features of the Step-by-Step JMeter Debugger

 

Feature 1: Running your Script Using the Debugger

 

  1. Go to Run-> Step by Step Debugger

  2. Maximize the pop-up window and click the “Start”  button at the upper right corner

  3. You probably noticed that:

    1. Sample #1 is highlighted in Blue

    2. General Constant Timer is now in focus

           This is because the debugger follows the JMeter scoping rules which means, execute the timer and then execute the sample. The debugger will always focus on the next element to be executed

 

Feature 2: Step by Step: Let’s See These Variables!

 

  1. Press the “Step Over”  button

  2. You probably noticed that the focus just switched to Sampler #1

  3. By pressing another “Step Over”, you will move to the Regular Expression execution

  4. Another “Step Over” will bring us to the “View Results Tree”

  5. Since the RegEx has been evaluated, you can see in the Variables tab that “RegExResponse” is now containing the string yada yada yada

 

JMeter Step-by-Step Debugger

 

Feature 3: Stop Before and After Listener Executions

 

You made it this far, congratz! You might be wondering what will happen in the next “Step Over”. Let’s find out.

 

Click it again.

 

You might have noticed that we are still in the “View Results Tree” listener even though it has been executed. Why?

 

Well, it’s not a bug. We just figured out that you will probably want to see the results before moving to the next element. So we might not want to switch the focus to sample #2 just yet.

 

Fun ha… :)

 

(we would also remove any disabled elements - just to make your script cleaner while you debug it)

 

Feature 4: Breakpoints

 

Just like any other IDE, we have breakpoints, just to save you gazillions of “Step Over” clicks! Let’s put a breakpoint on “Sample #2” by right clicking on it and select “breakpoint”. Then close and reopen the debugger, and then click on the “Continue”  button. The debugger has stopped at Sample #2, just before it’s starting to execute its scope.

 

Feature 5: Evaluate Things on the Fly

 

You know the feeling when you want to see the value of a variable/function and monitor when it has been changed? Meet the Evaluate tab!

 

  1. Let’s restart the debugger from scratch and put a breakpoint on the RegEx2 element (under sample #2)

  2. Now before pressing “Continue”, let’s go to the Evaluate tab and put our #RegEx variable name (RegExTimestamp) in the JMeter expression line

  3. Press “Continue” and wait for the debugger to stop before executing the RegEx

  4. You may notice that the value of the JMeter expression ${RegExTimestamp} is the string ${RegExTimestamp}. This is because JMeter has yet to initialize that parameter

  5. By pressing “Step Over”, you will cause JMeter to initiate this JMeter variable and now the Evaluate tab will show the variable value (see image below)

  6. You can use the “Step Over” over and over and on each time, the debugger will reevaluate that string for you

 

JMeter Step by Step Debugger

 

Next Steps / On Our Roadmap

 

  • We are going to add a stop button so you won’t need to close the debugger to restart your debugging session

  • We are also going to mark any variable which just changed in Bold so it will be easier to recognize which variable just changed

  • Improving the breakpoints stop on scope (and not the sampler)

  • Keyboard shortcut to open the debugger (we will do our best :) )

 

So, to conclude - the Step-by-Step debugger is a significant tool which every JMeter scripter should have in their tool box. In addition to debugging your scripts, you can also understand how JMeter scoping works and see, for the first time, the execution order of your test plan.

 

As a best practice, we advise you to save your test plan before starting the debugger.

 

Feel free to check out the project page in GitHub - https://github.com/Blazemeter/jmeter-debugger

 

And in case you found a bug, please report about it here: https://groups.google.com/forum/#!forum/jmeter-plugins

 

Want to Know More About What's New in JMeter?

 

  1. Check out our recent post - 5 Key Things You Need to Know About JMeter 3.0

  2. View an on-demand webcast about JMeter 3.0

     
arrow Please enter a valid URL

Interested in writing for our Blog?Send us a pitch!

We're working on starting your first test

Testing 20 Virtual Users

Starting your test in around 2-4 minutes. Your report will appear once we've gathered the data.

0

Status: Preparing Your Test

Your email is required to complete the test. If you proceed, your test will be aborted.