Undo, Redo & BackUps in JMeter
Undo, Redo & BackUps in JMeter
- Undo & Redo in JMeter:-
Undo and Redo are the very basic feature of any Editor or any IDE. Its really annoying that such basic feature is not found in JMeter. Here is the catch, JMeter do come with this feature, but not by default, and we have to enable it from our end. JMeter Team believes in making JMeter as light as possible and they are avoiding extra memory consumption that JMeter can take, and hence this feature is kept hidden or disabled by default. In this article, we will address this challenge.
Initially, the JMeter toolbarwithout these Undo/Redo button looks like below:-
To enable this feature, we have to go inside the “bin” folder of JMeter directory, and open “jmeter.properties” file using Notepad or Notepad++. In this file, we have to search for “undo.history.size”, as illustrated below:-
Now, we have to uncomment the property line “undo.history.size=0” by removing sharp character # and set a number. This number must be an integer number (or a whole number). It can be anything greater than Zero and upto suggested value, 25, (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)).
We can give 1 or 5 or 7 or 10 or 12 or 15 or 25, but not Zero. If we give Zero, there will be no changes happening.
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 thebigger it is, the more it consumes memory. When we try to undo/redo more than 5-10 steps at a time, we will notice a big slowdowns in JMeter. Hence, JMeter team has suggested a maximum value of 25 and that too for a strong computer with very high RAM memory.
For most of the normal users, giving this value a number 5 or 7 will suit for all. Here, I am giving it 5, as illustrated below:-
Next, save this “jmeter.properties” file after above change, and restart the JMeter.
N.B.:-
1.Always, remember to Restart the JMeter whenever we do any changes in any of the six“properties”files or any “bat” file in the “bin” folder so that changes can take place in JMeter GUI. Also, remember to Restart JMeter if we do any changes in “lib” folder or “lib -> ext” folder in JMeter directory for the changes to take place.
- You can do the necessary changes in “jmeter.properties” file either directly, or instead of doing any changes in this file, just copy the required lines and paste it in “user.properties” file and do the necessary changes there. Its always recommended(and best practice) to not to do any changes in default values in “properties” files such as “jmeter.properties”, “reportgenerator.properties”, “saveservice.properties”, “system.properties”, and “upgrade.properties”. Instead, we need to copy the required lines from these mentioned “properties” files to “user.properties” file and do the necessary changes.
After you restart the JMeter, we will get the desired changes as illustrated below:-
N.B.:- Here, we have one limitation, Ctrl + Z or Command + Z (in Mac OS) will not work for this case. Only clicking the Undo/Redo button in the toolbar will work out.
Now, you need to perform some action or do something so that these 2 buttons gets colorfully visible and clickable, as illustrated below:-
We can also do Undo/Redo from “Edit” option of the JMeter(after above changes in “jmeter.properties” file), as illustrated below:-
We can also do Undo/Redo from “Context Menu” as well,by right clicking on any of the Element(after above changes in “jmeter.properties” file), as illustrated below:-
2.Automated BackUps in JMeter:-
JMeter always automatically takes backup of each Test Plan/Scripts that we create, into the “backups” folder of JMeter directory. We do not need to setup anything. Backup files for a Test Plan/Script are automatically created when we save a Test Plan.Illustration goes as:-
Initially when we download a Fresh Copy of JMeter, this “backups” folder is not present in JMeter directory. Only when we start creating any Test Plan/Script, this folder is created automatically and backup files are saved there for each Test Plan/Script.
Backup feature is enabled by default. Also, there is no expiration time set for these backups, that means,they are keptforever. We have to manually delete them when we find them unnecessary or we have to free up some space.
By default, only 10 backups are preserved per Test Plan/Script. It means, suppose we have a Test Plan with filename “JPetStore1.jmx”, then only 10 latest backups of this Test Plan will be kept in this “backups” folder. Older backups for this Test Plan, except latest 10, will be automatically deleted. Similarly, take another Test Plan with file name “WebTours1.jmx”, so only 10 latest backups of this Test Plan will be kept in the “backups” folder.
We can change this number of backups per Test Plan/Scripts to be kept, or location where to Save these Backups and give our own value.
To do these changes, we have to go inside the “bin” folder of JMeter Directory, and open “jmeter.properties” file using Notepad or Notepad++. In this file, we have to search for “JMX Backup configuration”, as illustrated below:-
We need to alter below five lines as shown in above image as per our need or requirement:-
#jmeter.gui.action.save.backup_on_save=true
#jmeter.gui.action.save.backup_directory=
#jmeter.gui.action.save.keep_backup_max_hours=0
#jmeter.gui.action.save.keep_backup_max_count=10
#save_automatically_before_run=true
1st line has default value “true”, it means backups will always be taken. You can give the value “false” if you do not want the backups to be taken or saved.
2ndline has no default value, it means the backups will be saved in the “backups” folder of JMeter directory. You can give your own Directory path for backups to be saved.
3rdline has default value “0”, it means backups are kept forever. If you wish that backups should be deleted automatically after certain period, then give your own value in hours.
4th line has default value “10”, it means 10 latest backups per Test Plan/Scripts will be kept in the “backups” folder. You can give your own value if you wish this number to be more or less.
5th line has default value “true”, it means whenever we run a Test, JMeter will always save a backup of that Test Plan/Script before running the test.
If we want to do some changes, just uncomment the above propertiesline and set the corresponding desired value of your own. Illustration goes as:-
N.B.:- Always remember to use “Backslash” (i.e. “/ ”) while giving File path or Directory path everytime in JMeter wherever required, because JMeter generally recognise the “Forward slash” (i.e. “ \ ”) as Escape Character. Refer to the above image.Its best practice to adopt.
Next, save this “jmeter.properties” file after above changes, and restart the JMeter.
(Best practice is to copy the required lines from “jmeter.properties” file and paste them in “user.properties” file, and do the changes there).
This Backup feature prevents anyone to lose his work.
Isha training solutions is offering ” Jmeter Core to Master” level course. For complete details, pls follow below link
JMeter Core to Master Level Course Content