Apache jMeter is an open source software, it's 100% pure Java based application designed to load test functional behaviours and measure performance. It was originally designed for testing Web Applications but has expanded its capability since then to other functionalities which include Heap DUMP, SMTP request, JDBC request, etc....
If you are building a web application, the server carries a lot number of applications and users. So it is necessary to know the capability of the server to handle simultaneous user requests or applications. jMeter is a tool which helps us in these type of scenarios. It simulates real-user behaviours and performance/load to test your application. It is not a browser and it doesn't render HTML pages like any other browsers, but just acts like a protocol level. It is designed to load the functional behaviour, measure performance of your application
Following Protocols are supported by jMeter:
bin/jMeter.bat
. On Linux/Unix, jMeter can be invoked by clicking on jMeter shell script.A Test Plan can be viewed as a container for running tests. It defines what and how to test. A complete test plan consists of one or more elements such as,
Right click on TestPlan - > Add - > Thread(Users) - > Thread Group
Thread Group is a collection of Threads. Each thread represents one user using the application. Basically, each Thread simulates one real user request to the server. The controls for a thread group will allow you to Set the number of threads for each group. For example, if you set the number of threads as 100; jMeter will create and simulate 100 user requests to the server to test.
Right click on Thread Group - > Add - > Samplers
Samplers are used to send any specific types of request to the server. You can add HTTP request sampler with method GET, POST, PUT, DELETE
Right click on Thread Group - > Add - > Listners
Listeners show the results of the sampler in the form of tables, graphs, trees and logs result in a file. The data gathered by jMeter can be visually accessed with the help of Apache jMeter GUI application which starts when jMeter.bat is executed. We can add more listener types for a sampler.
Right click on Thread Group - > Add - > Timers
We can add a timer element which allows you to define a period to wait between each request.
Right click on Thread Group - > Add - > Assertions
Assertions allow you to include some validation test on the response of your request made using a Sampler
Right click on Thread Group - > Add - > Config Elements
Configuration Elements allow you to create defaults and variables to be used by Samplers. They are used to add or modify requests made by Samplers.
Right click on Thread Group - > Add - > Pre processors
The pre-processor element allows you to runs something just before a sampler executes.
Right click on Thread Group - > Add - > Post processors
A post-processor element allows you to runs something after a sampler finishes its execution.
Now we are going to test the sample login application in ColdFusion with jMeter tool. Create a Thread Group with 100 threads which Equals to 100 users.
Create a HTTP request sampler for the login page. Login URL is http://mitrahsoft.local/login_Apps/login.cfm, In URL text box, we should add the domain name alone, we can add the remaining path in the path text box. Also, we can add Http/https protocol.
We can create multiple listeners for the above sampler. Here I've added Graph Listener to view the above HTTP sampler's result.
Since we need to login into the application, we need to create a new sampler with HTTP request for the action page. Here the action page needs form values so we choose the POST method for this sampler. We can add multiple form values in Send paramters with the request field
Add the input element name in Name column and add values in corresponding values column, Need to check the Include Equals checkbox
In my application UserName, password, submit form fields are required to login.
After running 100 threads the result is generated like the image below.
As the time goes, the technology has seen a draftic developement. Now with the help of tool like jMeter, we are able to create something which really does not exists. For large scale testing, jMeter would be a really handy tool to test our server's capability. With the vast feattures like Heap dump creation, LDAP request, SMS services..etc available in jMeter, we can do real-time user like testing of our server.