Introduction
JMeter is basically a performance testing tool and it is purely java base software and java base application.JMeter support multiple platforms.JMeter originally is used for testing web application or FTP application.Now days, JMeter used for a functional test, database server test and API testing.
Use of JMeter for Performance and Load Testing
Load Testing:-load testing is a crucial tool that determines whether the web application under test can satisfy high load requirements or not.It also helps to analyze overall server under heavy load.
Performance Testing:-Performance Testing is method performed using Apache JMeter to test the performance of a web application.JMeter for performance testing helps to test both static and dynamic resources, helps to discover concurrent users on website and provides variety of graphical analysis for performance testing.
How dose JMeter works
â– A group of users sending request to target server
â– Server Response
â– Saves all Response
â– Collect and calculate statistic Information
â– End the process
â– Generate the report
Steps for Creating a JMeter Test
OPening JMeter
The first step is to open JMeter.
In Windows, you'll go to wherever you installed JMeter on your computer, open the JMeter folder, open the bin folder, and find and open the jmeter.bat file. (If you're using a Mac, you'll need to navigate to and open the jmeter.sh file. Otherwise there is no difference from Windows)
You'll notice that opening this file will first open a console window. Do not close that console window. Doing so will close the JMeter application, and you'll have to go back and open that jmeter.bat file again.
After a moment, JMeter itself will open.
Creating a Test Plan
When you open JMeter, there will already be a test plan created for you. You can rename it, add comments, and adjust settings from that opening window.
Adding a Thread Group
To add a thread group (a group of simulated users), simply right click on your test plan and select Add -> Threads (Users) -> Thread Group.
From there, you can rename the thread group and adjust settings.
The most important settings here are the number of threads, ramp-up period, and loop count. The number of threads is the number of simulated users that will be hitting the application being tested. The ramp-up period is the amount of time from the test start for all the threads to start.Finally, the loop count is the number of times the test will be executed per user.
Adding a Request
At this point, you'll need to have an idea of what you'll be testing.
To add your request, right click on your thread group and select Add -> Sampler -> HTTP Request.
From here, of course, you can now edit your request, just as with your test plan and thread group.
You'll notice that you can edit the name and add comments, as with each of the previous elements we added. Assuming the website you're testing uses the https protocol, rather than http, you'll need to enter https as the protocol. If the site you're testing uses http, you can leave it blank or enter http. You'll need to enter the root of the website in the "Server Name or IP" field. Finally, you should enter the path of the page you'd like to test. If you're trying to test the site's home page, you should just enter a "/" into the "Path" field.
Adding Listeners
Listeners are important because otherwise you wouldn't have anything storing the data from how the application reacts to the simulated users hitting it. JMeter supports a number of different types of listeners, so be sure to explore which ones best support your particular tests. For the purpose of this example, we'll add two simple ones.
Table
A table will give you various raw data from your tests, including sample time and latency. To add a table, you should right click on your thread group, then select Add -> Listener -> View Results in Table.
Save the test
Before starting your test, you should save it. Use Ctrl + S to save or Ctrl + Shift + S to save as. You can also use the dropdown menu File -> Save or File -> Save Test Plan As.
Starting the Test
After Saving, you will start your test is just to click the big green play button at the top of the screen or use the keyboard shortcut Ctrl + R.
Result
Once you start your test (see below), you should see results starting to come in, and you'll be able to view them in, you guessed it, a table:
Comments