JMeter has an automated process to take the backup of each Test Plan or Script that you create. This is a good feature for a performance tester to save his work from any unexpected loss. This backup is available in the “backups” folder of the JMeter directory. By the way, you do not need to set up anything to take the default backup of the script. Backup files for a Test Plan/Script are automatically created by JMeter when you save a Test Plan. The illustration goes as:
Default Setting of JMeter Script Backup:
Initially, when you download a fresh copy of JMeter then this “backups” folder is not present in the JMeter directory. Only when you start creating any Test Plan/Script then automatically the backup feature is enabled which creates a “backups” folder. After that JMeter starts saving the backup files for each Test Plan/Script in this folder.
Also, there is no expiration time set for these backup files which means they are stored forever unless you delete them manually. You can delete these backup files when you find them unnecessary or want to free up memory space.
By default, only 10 backups are preserved per Test Plan/Script in the backups folder. For example, if you have a Test Plan with the filename “JPetStore1.jmx”, then only the 10 latest backups of this Test Plan will be kept in the “backups” folder. The older backups for this Test Plan, except the latest 10, will be automatically deleted. Similarly, if there is another Test Plan with the filename “WebTours1.jmx”, so only the 10 latest backups of this Test Plan will be kept in the “backups” folder.
Custom setting of JMeter Script Backup:
You can customise the setting of the automated JMeter script backup process by changing in the “jmeter.properties” file. Follow the below steps:
Step 1: Go to the ‘/bin’ folder of JMeter and open the ‘jmeter.properties’ file in Notepad or Notepad++
Step 2: Search for “JMX Backup configuration”. You will find 5 properties lines as shown below:
Explanation of properties lines:
The first line “jmeter.gui.action.save.backup_on_save” has a default value of “true” which indicates that backups will always be taken. You can give the value “false” if you do not want the backups to be taken or saved.
The second line “jmeter.gui.action.save.backup_directory= ” has no default value which means the backups will save in the “backups” folder of the JMeter directory. You can give your own directory path if you want to save the backups at any other location.
The third line “jmeter.gui.action.save.keep_backup_max_hours” has a default value of “0” which implies keeping the backup file forever. If you want backups to be deleted automatically after a certain period then give your own value in hours.
The fourth line “jmeter.gui.action.save.keep_backup_max_count” has 10 as the default value. It indicates that JMeter will store up to 10 latest backups per Test Plan/Scripts in the “backups” folder. You can give your own value if you wish this number to be more or less.
The fifth line “save_automatically_before_run” has a default value of “true” which signifies whenever you run a Test, JMeter will always save a backup of that Test Plan/Script before running the test.
If you want to do some changes, just uncomment the respective properties line by removing the “#” sign and setting the corresponding desired value.
Always use “Backslash” (i.e. “/ ”) while giving File path or Directory path in JMeter, because JMeter generally recognises the “Forward slash” (i.e. “ \ ”) as Escape Character.
Always keep an original copy of “jmeter.properties” file or paste the original properties lines in “user.properities” file and do the changes.
Step 3: Save “jmeter.properties” file after doing the changes and restart the JMeter.
The biggest advantage of this Backup feature is to prevent you from unexpected loss of script and rework, so keep it enabled and get the benefit.
You may be interested: