Apache JMeter is a great tool for simulating performance testing on web-applications, but it may seem tricky at first glance. Check out this presentation to learn how to create your first JMeter script from scratch.
SCRIPTING WITH JMETER
Apache JMeter is a great tool for simulating
performance testing on web-applications, but
it may seem tricky at first glance.
Learn how to create your first JMeter script
• Download JMeter from the official Apache JMeter
• Unzip the distribution and copy it a folder on your
• You need to have JRE 1.6 or above to run JMeter,
because it's written in pure JAVA.
• If you are running WINDOWS- Go to
$JMETER_HOME/bin and run jMeter.bat or If you
are using *nix –Go to JMeter
TEST PLAN (1)
The Test Plan is the core element of the test script.
2 tables and 3check-boxes.
TEST PLAN (2)
• User Defined Variables, allows us to set variables, which can
be used in any other part of the script
• These values can be set up as a variables simply eliminating
the need to update the script.
• Is used for making test plan databases, in order to make the
JDBC driver visible for JMeter and able to execute the SQL
• Add JDBC *.jar to this table, and JMeter will recognize it.
CHECK BOX #1
If this option is checked, than all Thread Groups will
be executed one by one.
This may be useful in cases such as if the first Thread
Group prepares test-data for a test, and the next one
uses this set.
Run Thread Group Consecutively
CHECK BOX #2
Some actions, like restoring the system after testing
to a default state may be assigned to tearDown
Run tearDown Thread Groups after shutdown of
CHECK BOX #3
JMeter can also be used for functional tests because
it has a set of elements which allow page retrieval
from the server.
Saves much more information about each request
using the functional test mode.
Consumes more memory for processing data stream.
Functional Test Mode
Every JMeter test plan should contain at least one Thread
Group and it will be the first element added to the test plan.
HTTP REQUEST DEFAULTS
Set default values for your HTTP Request controllers use:
For example, if you are creating a Test Plan with 25 HTTP
Request controllers and all of the requests are being sent to the
same server, you could add a single HTTP Request Defaults
element with the "Server Name or IP" field filled in.
Use the same URL for all requests. Add the site that will be
click links one
by one, without
Naturally, there is a delay between thoughts and
therefore user think-time needs to be emulated.
JMeter has a set of Timers, which allows users to set up a
pause between different requests.
Add Constant Timer to generate the delay for the fixed
amount of time.
HTTP COOKIE AND CACHE MANAGER
HTTP Cookie Manager: used for
emulating browser's work with
HTTP Cache Manager: used for
saving downloaded pages in cache
during the first request, so they
could be returned to Listener
without downloading. This
approach, obviously, has influence
on test results.
VIEW RESULTS TREE
This element is
View Results Tree is in regards to memory consumption because it
stores, in memory, all the results of requests.
If it is used while there are many virtual users, memory will run
out. So remove or disable the View Results Tree all other graphic
listeners before running a test.
RUNNING A LOAD TEST WITH
If you already have your BlazeMeter account set up, you can
simply click “Add test”.
If not, create your FREE account now!
UPLOAD TEST SCRIPT
Upload the JMeter script to BlazeMeter
Adjust the test plan settings using the controls on the right side of
the page. Press SAVE. Press START.
Load Report Tab
All graphs represent KPIs
during the load.