Build JMeter Test Plan
What Is A Test Plan In JMeter ?
Test Plan can be considered as a container that defines what to test and how to go about it. It is a root node that has potentially many levels of additional elements/nodes forming a hierarchy, which JMeter executes when test plan runs.
A test plan consists of one or more elements such as thread groups, logic controllers, samplers, timers, listeners, assertions, and configuration elements. A test plan must have atleast one thread group.
Building a Test Plan
Below the steps are given to build a test plan, follow these steps -
Step 1 : Launch the JMeter Window
-
To open the JMeter window, go to the directory where bin folder of JMeter is located and run jmeter.bat file.
-
In my case, the full path is 'C:\Users\softwares\apache-jmeter-5.5\jmeter.bat'
-
The JMeter window will appear as shown below -
-
It contains a node Test Plan which keeps the actual tests.
Step 2 : Add/Remove Elememts
Elements can be added or removed to a test plan by right-clicking on the Test Plan node.
To add an element :
-
Right-click on the Test Plan node, hover the mouse on option 'Add'.
-
You will see a list of types of elements, hover any of them.
-
Let's move ahead with 'Threads(Users)', so hover on it and select the element 'Thread Group'.
-
An element Thread Group is added to the test plan as shown in below screenshot -
To remove an element :
-
Right-click on the element you want to remove and click on option 'Remove'.
-
A confirmation popup will appear, click on Yes to remove.
-
The selected element is removed successfully.
Step 3 : Add Elements to a Test Group
The elements can be added to a thread group to perform testing.
-
Right-click on a thread group and hover on the option 'Add'.
-
Under the Add option, hover on an option.
-
Here I choose option 'Sampler' and hover on it, select option 'HTTP Request' by clicking on it.
-
As of now, just fill 'https' as Protocol[http:] and 'www.myautomationhub.com' as Server Name or IP on the contro panel.
-
The http request is created as below -
Step 4 : To Generate a more Readable Execution Report
JMeter facilitates us to view the test result in a readable format using Listeners.
-
Right-click on a test group, hover on 'Add', then hover again on 'Listener' and click on 'View Results Tree'.
-
The view results tree listener is added to the test group.
Step 5 : Save the Test Plan
Test Plan must be saved before running and to retain any loss.
-
Click on your test plan, then click on File from the menu bar.
-
Click on 'Save' or 'Save Test Plan as' and click on 'Save' keeping the defaults unchanged.
-
The test plan has been saved now.
Step 6 : Run/Stop the Test Plan
Now it's time to run our test plan. Make sure you've saved your test plan before running.
To run :
-
In the header part of the GUI window, there will be a green symbol to start the test plan.
-
Just click on that green start symbol to run the test plan.
-
To view the result, go to the View results Tree and view the result in the given tabs.
-
If a green verification symbol with the test element is shown inside the result tree, then the test is executed successfully that means there's no programmatical error in the test plan.
To stop :
-
There's a Stop labled symbol in the line of Start symbol.
-
Just click on that Stop symbol to terminate the test.
Refer next page JMeter Test Plan Elements