What is JMeter?
JMeter is Open Source testing
software. It is 100% pure Java application for load and performance testing.
JMeter is software allowing
loading test or performance oriented business (functional) test on different
protocols or technologies. Stefano Mazzocchi of the Apache Software
Foundation was the original developer of JMeter. He wrote it primarily to test
the performance of Apache JServ (Now called as Apache Tomcat project). Apache
later redesigned JMeter to enhance the GUI and to add functional-testing
capabilities.
This is a Java desktop
application with a graphical interface using the Swing graphical API, can therefore
run on any environment / workstation accepting a Java virtual machine, for
example: Windows, Linux, Mac, etc.
Why do we Use JMeter?
JMeter is designed to cover categories of tests like load, functional, performance, regression, etc., and it requires JDK 5 or higher.Installing Jmeter
Before installing JMeter we have to make sure that java is present in our machine.Then we need to download the JMeter zip file and unzip the file. We need not install anything in order to invoke JMeter we just need to click on the Jmeter.bat file present in the bin folder.
How do we Run JMeter?
As we have already discussed earlier, JMeter runs on different environment we have different ways to invoke JMeter in different environments.
OS
|
Output
|
| Windows | jmeter.bat |
| Linux | jmeter.sh |
| Mac | jmeter.sh |
Once clicked on the above file, after a short pause, the Jmeter GUI should appear which is a Swing application as seen in the image below
This is the main page and default page of the tool.
This is a Jmeter window having nothing added yet. Details of the above window are:
·
Test Plan
node is where the real test plan is kept.
·
Workbench
node simply provides a place to temporarily store test elements while not in
use, for copy/paste purposes. When you save your test plan, Workbench items are
not saved with it.
POC:
A test plan describes a series of steps JMeter will execute when run. A complete test plan will consist of one or more Thread Groups, logic controllers, sample generating controllers, listeners, timers, assertions, and configuration elements.Apache JMeter HTTP(S) Test Script Recorder
1. Select
“Test Plan” on the tree
2. Right
click on the “Test Plan” and add a new thread group: Add > Threads (Users)
>Thread Group
3. Select
the Thread Group
4. Right
click “Add -> Config Element -> HTTP Request Defaults”
5. In new
HTTP Request Defaults element: Server name – enter “google”
6. Path –
leave blank
7. Right
click on the “Thread Group” and add a recording controller: Add > Logic
Controller->Recording Controller
8. Next,
select WorkBench
9. Right
click on WorkBench and add the recorder: Add -> Non-Test Elements ->
HTTP(S)Test Script Recorder
10. On
HTTP(S) Test Script Recorder, click the “Add” button in “URL Patterns to
Include”. This will create a blank entry; enter “.*\.html”.
11. Right
click on “HTTP(S) Test Script Recorder” and add a listener: Add -> Listener
-> View Results Tree
12. Return to HTTP(S) Test Script Recorder, and
click the “Start” button at the bottom This will start the JMeter proxy server
which is used to intercept the browser requests.
Configure browser to use the JMeter Proxy
At this point, JMeter's proxy is running. For this exercise, we will use Firefox toview some pages on the Google website.
Start Iceweasel/Firefox, but do not close JMeter.
13.
From the tool bar, click “Edit ->
Preferences” (or “Tools > options”).
14. Select
the
“Advanced” tab, and “Network” tab
15. Click
“Settings” button
16. On the
new pop-up, check “Manual proxy configuration”. The address and port fields should
be enabled now.
17.
Address – enter “localhost” or the IP
address of your system
18.
Port – enter
“8080”.
19.
Check “Use this proxy server for all
protocols”
20.
Click
"OK" button
21.
Click “OK” button again. This should return
you to the browser
Record the Navigation
22.
With browser, in the “Address” bar at the top,
enter “http://google.com” and hit the “enter” key.
23.
Click on a few links in Google page.
24.
Close the browser and bring up the JMeter
window.
25.
Expand the
thread group and there should be several samplers. At this point, the test plan
can be saved as is "sampletest.jmx". If you forget to add default
HTTP Request settings, you will have to manually delete the server name, and
port.
26.
Select
“Thread Group"
27.
Right click “Add -> Listener -> Summary
Report” to add an summary listener.
28.
The summary
listener will show some basic statistics.
29.
Select “Thread Group”
30.
Number of Threads – enter “5”
31.
Ramp up Period – do not change
32.
Loop Count –
enter 100
Start the test
At this point, we are ready to
run our test plan and see what happens. Save the test plan.
When you're ready to run the test.
1. Run -> Start
Before start the test, select “Summary Report”. As
the test runs, the statistics will change
until the test is done. At the
end of the test, the summary report should look like this.






0 comments:
Post a Comment