This article is contributed. See the original author and article here.
By Raman Pandey
Hello everyone, this time we bring you another JMeter post for those performance testers following this blog. JMeter is a very extensible and customizable tool, however sometimes it may need a few tweaks to make it look and behave the way you want on your specific OS and setup.
For example you can configure the log, enable and configure HiDPI (High Dots per inch) scaling, change the size of fonts, icons, toolbars, among many other things. This time around though, Raman will explain how to enable and configure Undo and Redo in JMeter and why it is not enabled by default:
Undo & Redo in JMeter
Here is the solution for reverting back mistakes/changes while creating these massive JMeter scripts:
Undo and Redo are a very basic features of any editor or IDE. It is really annoying that such a basic feature is not found in JMeter. Here is the catch. JMeter has this feature but not by default and therefore we have to enable it from our end. JMeter team believes in making JMeter as light as possible and they are avoiding the extra memory consumption that would take place, therefore Undo and Redo options are kept hidden or disabled by default.
Initially, the JMeter toolbar without the Undo and Redo buttons looks like this:
Follow the below steps to enable these options:
- Navigate to bin folder of JMeter directory
- Open jmeter.properties file using Notepad or Notepad++
- Side note here, you may prefer to make these changes in user.properties which would only apply to your user but the values on this file supersede values on the other properties file. Also if you mess up, you can always reset with the content of jmeter.properties.
- Search for undo.history.size
- Uncomment the line undo.history.size=0 by removing # (sharp sign)
- Set a natural number as a value of undo.history.size attribute e.g. 1, 5, 10, 50 etc. (This number represents the maximum number of steps that you can undo or redo.)
- Save the file and relaunch JMeter to reflect the changes.
The number must be a natural number (1,2,3,….n) or simply say positive integer other than 0. The suggested value by JMeter is 25 which you can see in the description above this line in “jmeter.properties” file, it shows “Set it to a number > 0 (25 can be a good default)”. So, you can give 1 or 5 or 7 or 10 or 12 or 15 or 25, but not Zero. If you give Zero, there will not be any changes
This number represents the maximum number of steps that you can undo or redo. You can set this to a larger number e.g. 50 or 100 but the bigger it is, the more it consumes memory. When you try to undo/redo more than 5-10 steps at a time then you will notice a big slowdown in JMeter. Hence, JMeter team suggest to have a maximum value of 25 and that too for a computer with very high RAM memory.
For most of the normal users, 5 or 7 solve their purpose. Here, I have given the value as 5 which shown above.
Once you restart the JMeter you can see Undo and Redo options in the JMeter toolbar which are greyed-out; indicate no action done yet.
Now, perform some actions in JMeter so that both the buttons get colorfully visible and clickable, as illustrated below
Ctrl + Z or Command + Z (in Mac OS) does not work in JMeter. Only clicking the Undo/Redo button in the toolbar works.
You can also do Undo/Redo from “Edit” option of JMeter or “Context Menu” by right-clicking on any of the Element as illustrated below:
That is it. Thanks Raman for sharing!
Please leave any comments or questions below.
Brought to you by Dr. Ware, Microsoft Office 365 Silver Partner, Charleston SC.