How to Create Test Plan Using Jmeter?
What Is Jmeter?
Apache JMeter is an open source and 100% pure java testing tool used for performance testing, load testing, and functional testing of web applications.
What Is Test Plan?
- The Test plan identifies the items, the features to be tested, the types of testing to be performed, the personnel responsible for testing, the resources and schedule required to complete testing, and the risks associated with the plan.
Create a Jmeter Test Plan
- A Test Plan can be considered as a root node that has potentially many levels of additional elements/nodes that form a hierarchy, which JMeter executes when we run the test plan. A Test plan can consist of more than one element such as thread groups, logic controllers, timers, listeners, etc but It must important to have a minimum of one thread group in every test plan.
Let’s start creating a test plan, by launching JMeter in the following steps:
- Go to the JMeter bin folder like D:\apache-JMeter-5.4.3\bin.
- Double click on Apache JMeter Executable Jar File
- After some time you can see the following Jmeter Screen
- Rename your Test Plan.
- User-defined variables give flexibility when you have to repeat values in several parts of the test plan.
- You can use it according to your needs.
Add Thread Group
After creating a test plan for JMeter, the next thing we should be learning is to Add Thread Group to JMeter Test Plan.
Steps to add Thread Group to JMeter test plan
1 — Select Test plan node
2 — Right click on the selected plan
3 — Mouse hover on the “Add” option, then elements will be displayed.
4 — Mouse hover on Threads (user)
5 — Select Thread Group
After creating the Thread Group element, you can see the following screen
Note: At this screen, elements can also be loaded from a file and added by selecting the “merge” or “open” options.
Need to follow the below steps to remove elements from the Jmeter test plan
When you add elements to a Test Plan, you may like to remove them by following steps :
- Select the desired element
- Right-click on the element
- Select the “Remove” option
Click on “Yes” to remove the confirmation popup
Load and Save the JMeter Test Plan
Above we learned to add and remove elements, now let’s discuss the Load and Save JMeter Test Plan.
Steps to Load Elements to Jmeter Test Plan
- Select and right-click on the Thread group in which you want to add the loaded element
- Click on the “Merge” option
- Select the .jmx file where you saved the elements
- Elements will be merged into that thread group
- Save the Test Plan /Element
Points to Load elements to JMeter Test Plan
- Select and Right click on the Thread element
- Select the “Save Selection As” option
- Save the file at the specified location
Steps to Configure Thread Group Elements:
We can configure it by using the control panel on JMeter’s right-hand side frame. The controls allow us to configure the behavior of selected elements like the number of threads, Ramp-up period and scheduler, etc. as shown below.
Till now we have done with Creating test plans, Adding elements, and configuring elements.
Let’s just move forward with different operations on the Test Plan like Save, Run & Stop
Recommended to Read:- Introduction of Apache JMeter Performance Testing Software
Steps to Save JMeter Test Plan:
Before Executing the test plan it’s better to save it. Test Plan can be saved by selecting “Save” or “Save Test Plan As” from the File Menu.
Steps to Run JMeter Test Plan:
A test plan is run by clicking on the Green Play button.
- The green button shows that the Test Plan is executing
- Total number of active threads
- The stop button enables when the Test plan is running
Steps to Stop JMeter Test Plan:
- Stop: This stood the thread immediately if possible. Many samplers are interruptible so active samplers can terminate early.
- Shutdown: This requests the threads to stop at the end of any ongoing task. It will not interrupt any active threads.
Steps to Check JMeter Test Plan Execution Logs
JMeter stores all Test run details, warnings, and errors to the JMeter .log file by default, You can use JMeter logs for debugging purposes.
- Jmeter shows the total number of errors in the log
- Click the yellow triangle button to view the log panel
- Logs display in the log panel
If you are interested in even more software testing-related articles and information from us here at Devstringx, then we have a lot to choose from.
Originally published at https://www.devstringx.com on September 14, 2022