In this activity, we will learn how to add test elements to Test Plan and configure them.
Let’s start JMeter by navigating to local drive\apache-jmeter-3.0\bin and then click on jmeter.bat file.
After starting JMeter, you shall see the graphical user interface with an empty Test Plan.
By the way let us understand – What is a Test Plan?
A test plan is composed of a sequence of test elements that determine how the load test will be simulated. We will understand how some of these elements can be used as we add them into our test plan.
Ex1: Rename test plan
Re-name Test Plan name as Training App
Ex 2: Add thread group
Now that we re-named our Test Plan, let us start adding few test elements to it:
First, let us add Thread Group to Test Plan:
1. Right-click on Training App
2. Mouse over Add >
3. Mouse over Threads (Users) >
4. Click on Thread Group
Now that we have added Thread Group, we will now see some of the parameters to configure:
Ex 3: Add HTTP request default
Let us understand, What is HTTP Request Defaults?
It is used to set default values for HTTP Requests in our test plan. This is particularly useful if we want to send multiple HTTP requests to the same server as part of our test.Now let’s add HTTP Request Defaults to Thread Group:
1. Select Thread Group, then right-click
2. Mouse over Add >
3. Mouse over Configuration Element >
4. Click on HTTP Request Defaults
Get the name or the IP address of the web server you want to test. Fill in the field Server Name or IP using the name or IP address.
Setting the server here makes it the default server for the rest of the items in this thread group.
Ex 4: Add cookie manager
Why do we need HTTP Cookie Manager?
If your web server uses cookies, it stores and sends cookies just like a web browser. If you have an HTTP Request and the response contains a cookie, the Cookie Manager automatically stores that cookie and will use it for all future requests to that particular web site.
Each JMeter thread has its own “cookie storage areaâ€. So, if you are testing a web site that uses a cookie for storing session information, each JMeter thread will have its own session. Note that such cookies do not appear on the Cookie Manager display, but they can be seen using the View Results Tree Listener.
Let’s add HTTP Cookie Manager to Thread Group and configure an option to Clear Cookies for each iteration:
1. Select Thread Group, then right-click
2. Mouse over Add >
3. Mouse over Config Element >
4. Click on HTTP Cookie Manager
Ex 5: Add recording controller TP
Let’s know Why do we add Recording Controller?
The Recording Controller is a place holder indicating where the proxy server should record sampler to. During recording using the HTTP(S) Test Script Recorder,all recorded samplers will by default be saved under the Recording Controller.
By the way, what is a sampler? Sampler allows JMeter to send different types of requests to a server. These are the actual requests, JMeter sends to the server under test.
Now let’s add a Recording Controller to Thread Group:
1.Select Thread Group, then right-click
2. Mouse over Add >
3. Mouse over Logic Controller >
4. Click on Recording Controller
Rename Recording Controller under Thread Group and give a descriptive name.
Ex 6: Add listener
Hah… now we know how to build a basic test plan using some test elements.
Let us explore what a Listener is? and try to add View Results Tree listener to our Thread Group