First step of starting performance testing with Jmeter is preparing Test Plan with all necessary components. Every time you end up adding same components into Jmeter Test Plan before creating the script. Well, you don’t need to do this repetitive task anymore. Use suitable Jmeter Templates and it will load all necessary components for you.
What is Jmeter Template?
Jmeter Template is a placeholder script consist of basic and necessary components. There are multiple formats of Templates already provided by Jmeter, but you can also create your own.
How to Add Jmeter Templates?
You can add Template into your Jmeter script two ways:
1) File > Templates…
2) Templates icon from Jmeter toolbar
Now you will see a pop-up window having “Recording” template pre-selected in the drop-down. Click on “Select Template” drop-down to access other available templates.
Each template window has a description and useful links which explains the components and pre-defined settings of that particular template. Now, let’s look at example of recording template:
As displayed in the image “Recording Template” is imported into Jmeter Test Plan and following components are automatically added:
– User Defined Variables
– HTTP Request Defaults
– HTTP Cookie Manager
– Thread Group
– Recording Controller
– View Result Tree
Beanshell Sampler Template
Unlike all other Templates, BeanShell Sampler does not override the Test Plan in Jmeter script. It is added as a sampler right into the script.
There are many more Templates provided by Jmeter 3.0 as given below:
– Recording with Think Time
– JDBC Load Test
– BeanShell Sampler
– MongoDB Load Test
– Building a Web Test Plan
– Building an Advanced Web Test Plan
– Building a SOAP WebService Test Plan
– Building an FTP Test Plan
– Building an LDAP Test Plan
– Building an Extended LDAP Test Plan
So, you don’t need to worry about which components to add for preparing Jmeter script. Use pre-defined templates and Voila!!