JMeter is one of the most popular open source-testing tools for load and performance testing. It simulates browser behavior, sending requests to the web or application server for different loads. Volume testing using JMeter on your local machine, you can scale up to approximately 100 virtual users, but you can go up to more than 1,000,000 Virtual Users with CA BlazeMeter, which is sort of a JMeter in the cloud.
Downloading and Running the Apache JMeter:
Since JMeter is a pure Java-based application, the system should Java 8 version or higher.
Check for Java installation: Go to Command prompt, type `Java –version’, if Java is installed it will show as the Java version as below.
If Java is not installed, download and install Java from the following link: “http://bit.ly/2EMmFdt”
- Download the latest version of JMeter from “Apache JMeter”
- Click on apache-jmeter-3.3.zip from Binaries.
How to Run the JMeter:
You can start JMeter in 3 ways:
- GUI Mode
- Server Mode
- Command Line
GUI Mode: Extract the downloaded Zip file in any of your drives, go to the bin folder D:apache-jmeter-3.2bin–> double click on “jmeter” windows Batch file.
After that will appear the JMeter GUI as shown below:
Before you start recording the test script, configure the browser to use the JMeter Proxy.
How to configure Mozilla Firefox browser to Use the JMeter Proxy:
- Launch the Mozilla Firefox browser–> click on Tools Menu–> Choose Options
- In Network Proxy section –> Choose Settings
- Select Manual Proxy Configuration option
- Enter value for HTTP Proxy as localhost or you can enter your local system IP address.
- Enter the port as 8080 or you can change the port number if 8080 port is not free
- Click on OK. Now your browser is configured with the JMeter proxy server.
Record the Test Script of Web Application:
Add a Thread Group to the Test Plan: Test Plan is our JMeter script and it will tell about the flow of our load test.
Select the Test plan –> Right click–> Add–> Threads (Users) –> Thread Group
Thread group will tell about the user flow and will simulates like how user will behave on the app
The thread group has three important properties, which influence the load test:
- Number of threads(users): This will tell about the number of Virtual users that JMeter will attempt to simulate, let’s say for ex:1,10,20 or 50 etc
- Ramp Up Period (in seconds): The duration of time that you want to allow the Thread Group to go from 0 to n (20 here) users, let’s say 5 seconds.
- Loop count: No of times to execute the test, 1 means the test will execute for 1 time.
2. Add Recording controller to the thread group: Recording controller should have all the recorded HTTP Request Samples.
Select the thread group –> right click–> Add –> Logic Controller –> recording controller
3. Add the HTTP Cookie Manager to the thread group:
4. Add View Results tree to the thread group: View results Tree used to see the Status of the Http Sample Requests on Executing the Recorded Script.
Thread group –> Add–> Listeners–> View Result Tree
5. Add Summary Report: Summary report will show the test results of the script
Thread group –> Add –> Listeners –> Summary Report.
6. Go to the WorkBench and Add the HTTP(S) Test Script Recorder: Here you can start your test script recording.
WorkBench –> Right click –> Add–> Non Test Elements –> HTTP(S) Test Script Recorder.
Check whether the port 8080 (this should be same as which we have set for the browser port number) is available or busy in your system. If it’s busy change the port number.
7. Finally click the Start button –> you can see the popup –> click ok
8. How to Record the browsing files from the Web App:
If your test script is having option like browse any files, keep your files in bin folder of JMeter and do recording of browse files.
Go to the Mozilla Browser–>Start your Test for Ex:login page or any navigation, do not close the JMeter while recording the script. The script will record as below in Recording Controller.
Save the Test Plan with .jmx extension.
Run the Recorded Script: Select the Test Plan–>Press ctrl+R from the Key board or Start Button on Jmeter.
while executing the script ,at the top right corner a circle will display in green color along with the time box which will show how much time the script is executing. Once the Execution completed the Green circle will turn to Grey.
Test Results: We can see the Test Results in many ways like, View Results Tree, Summary Report, and Aggregate Graph.
View Result Tree
After executing the test script, go to Summary Report–>click on Save Table data and save the results in a .csv or xlsx format.
Though we will get the test results in Graphical view and Summary report etc, executing Test Scripts Using JMeter GUI is not a good practice. I will discuss the execution of JMeter Test Scripts with Jenkins Integration tool in my next blog.
Read Other Blog on Load Testing: