In Part-1 we have gone through Types of Performance Testing, Performance problems, Performance Testing Process, Metrics of Performance Testing and some reasons for using JMeter for Performance Testing.
Here we will go through JMeter Installation and Testing using JMeter.
JMeter Installation and Testing:
JMeter is JAVA application, so it is platform independent. Following are the steps to install JMeter.
Step 1: Check if JAVA is installed on your system
Open the command prompt
Put the command java -version
If you have Java installed in your system, the command will show the version of Java installed, else, before going forward with the installation of JMeter you must install Java.
Step2: Download JMeter
To download JMeter go to the Apache JMeter website. https://.apache.org/download_jmeter.cgi
On the website go to the binaries section and download the zip file
Wait for the zip folder to be downloaded
Step3: Install JMeter
Once the zip folder is downloaded, go to the folder location, and then extract the zip folder
Once the folder is extracted go inside that folder and then go inside the bin folder here
In the bin folder open the jmeter.bat file
JMeter is installed , now you can execute a test for the same.
Step4: Create first Test Plan
Test plan is a container which will contain all your test elements that you need to perform the test.
The JMeter window is divided into two parts. The left side has all the added elements, while the right side has all the elements' configurations.
Rename the test plan and save it. (Here we are renaming it as ‘MyFirstTestPlan’)
Step5: Add Thread Group
Thread Group are the users created to run the tests.
Right-click on the test plan.
Go to add -> Threads (Users) -> Thread Group
For better understanding we are renaming the Thread group as ‘Users’
There are three things on the screen that are important concerning the load test:
The number of threads (users): This is the number of threads or users JMeter will simulate.
(Let's make it 20)
Ramp-Up Period (in seconds): This is the time that JMeter takes before starting the thread over.
(Let’s keep this as 10)
Loop Count: This is the number of times the test will be executed.
(Let’s keep this 1)
Step 6: Add an Http Request
Right-click on MyFirstTestPlan Thread Group(here Users) and again go to add
In the drop-down select samplers
For now, choose the simplest of them all, the HTTP request.
Here you will have to give the address to some home pages or websites.
Now, rename it to be HomePage.
Here, in the Server Name or IP box, you have to give the server name or the IP.
Let's pick up a website; for now, take Numpy Ninja's website.
Copy the URL
Come back to the JMeter window and paste it into the Server Name box.
Don't give HTTP or HTTPS since these are protocols that will come in the other box. They will be automatically taken in the HTTP request case.
Then in the path dialog box, leave a forward slash there.
Step 7: Add Listeners
To determine what the results of the test will be, you need to add some more test elements.
Right-click on Group Thread(Users)
Go to Add--> Listener
For now, selecting four of these:
View results in table
View results tree
Summary Report
Graph Results
On the left you can see the four Listeners added to the Http request(HomePage).
Step 8: Run the test
Now, save the test and run it
For running the test, click the green button
Now, check the results of the test
Step 9: Get the Results
1. Go to View Results Tree
The green status or the success status code 200 OK can be seen here . You can see the Request body as well.
The test will be performed concerning the number of users, the ramp-up period, and the loop count set up in the first step.
Hence, here on the screen, it is evident that the test is still running. The time is taken, the number of tests being performed, and the status of each hit onto the Numpy Ninja website can be seen.
2. Go to View Results in Table
You can see the green status that shows that the test was successful. The label name: HomePage, Latency(indicates how long it takes from the moment a request is sent by a user until the first byte is received by the server) and the sample time can be seen.
3. Go to Summary Report
Here in the summary report you can see samples (number of requests sent) for particular request, total samples, min and max response time, error rate( percentage of failed tests), Throughput(How many requests per sec your server can handle), Avg Bytes.
4. Go to Graph Results
At the bottom of the picture, there are the following statistics, represented in colors:
Black: The total number of current samples sent.
Blue: The current average of all samples sent.
Red: The current standard deviation (indicates the deviation from the average).
Green: Throughput rate that represents the number of requests per minute the server handled.
Kommentare