What is JMeter?
JMeter is an open source software testing tool for load and performance testing mainly. It is purely a java desktop application with a graphical interface, designed to cover the testing part such as load, performance, stress, functional, etc. Hence its can run on any environment / Workstation for example − Windows, Linux, Mac, etc. It is widely used to calculate the performance of a web site and analyze the overall system performance under different load types. It also allows you to test the HTTP requests.
JMeter Download link : http://jmeter.apache.org/download_jmeter.cgi
Before jumping on the JMeter details, let’s take a look on the basics for testing any application:-
- Performance Test: – Is a non- functional testing technique performed to analyze the process of determining that how fast a system can perform efficiently under a particular workload.
- Load Test: – load test is mainly used to determine a system’s behavior under both normal and heavy conditions.
- Stress Test: – Stress test is mainly done to test the scenario beyond the normal operation level, so as to check the system that how much heavy load the developed system can handle if the given load is above the capacity level and the system does not crash under such circumstances.
Let us take a view that how the JMeter works for web pages and how the web page is finally displayed after the request is been raised. In JMeter when a user clicks on a link or fills a form and submit, browser sends the request in HTTP format to the server.
The server receives the HTTP request creates HTML response and sends back HTML to browser, browser receives the request and the user can see the Text or form.
Now introducing Apache JMeter into the picture. The actions taken by the User are no longer required. The User action trigger some HTTP requests which are recorded in a JMeter HTTP Request Sampler for multiple uses.
Whenever HTTP request sampler is added in JMeter, Test plan keeps the record of calling webpage and the receiving sequence of it. This is called as single transaction, that can be repeated and JMeter gets capable of doing the same thing numerous times simultaneously, that too with the record of all the gone and came transaction request.
There are many options given in JMeter to keep the track of all the HTTP request received data that is needed for further analysis in HTTP request Sampler. There are other sources also to keep that track of the request that is View tree listener, which help to know that what request was sent, what response was received, and what was the result of the received transaction, which gives us the detailed report of the request sent and received from the browser to the server and from the server to the browser.
The two main components for using these listeners are:-
1. Test plan
For web testing different samplers and listeners are required from those some of them are listed below:-
1. Thread Group
2. HTTP Request Sampler
3. Recording Controller
4. View Tree Listener
5. Summary Report Listener
6. Aggregate graph
Descriptions of main components in JMeter are:-
1. Test Plan:-
Test plan is a container for the entire files, setting of all the executed files that describe the steps of running files. It specifies what to test, how to go about and a place where the real test is kept. Every time when a test plan runs the entire test script should be saved and executed.
It is simply the place that stores the test elements temporarily while not in use. Whenever the workbench is tried to save with the test plan it never gets saved with it.
One can added and also remove the added items in the workbench and from the test plan also.
Description of Sub components are:-
1. Thread Group:-
Thread group contains all the other elements under it for running the test case against application. Under thread group there are many samplers and listeners that can be added for the test execution.
In thread group we can also control the following:-
- Number of threads
- Ramp-up time
- Loop count (Number of test iterations)
2. Samplers :-
Samplers allow JMeter to send the request to the server. There are different types of samplers in JMeter that can be used in our test case.
The main sampler used in JMeter for web testing application is HTTP request.
Some useful samplers used are:-
- HTTP Request
- FTP Request
- JDBC Request
- Java Request
- SOAP/XML Request
- RPC Requests
3. logic Controller:-
Logic controller helps to control the order in which samplers are been processed in a thread. We can change the order of request coming from any of their sub elements.
Various other logic controllers that can be used are:-
- Simple Controller
- Recording Controller
- Loop Controller
- Random Controller
- Random Order Controller
- Throughput Controller
- Runtime Controller
- If Controller
- While Controller
- Switch Controller
- For Each Controller
- Module Controller
- Transaction Controller
Listener helps us to view the result that can be generated in various other formats like tables, graphs, trees or text logs files.it helps to compile the result of executed test. In a single test plan one should try to add minimum listeners as it also consumes lot of memory and slowdowns the JMeter performance.
Some of the listeners in JMeter are:-
- Sample Result Save Configuration
- Graph Full Results
- Graph Results
- Spline Visualizer
- Assertion Results
- View Results Tree
- Aggregate Report
- View Results in Table
- Simple Data Writer
- Monitor Results
- Distribution Graph (alpha)
- Aggregate Graph
- Mailer Visualizer
- Bean Shell Listener
- Summary Report
With the help to these components web testing can be performed. The hierarchy
Of the above should look like:-