Using JMeter effectively consists of the following activities
Choosing A SamplerController
JMeter has two tabs -
setup
and
run
.
Within
setup
, the default SamplerController is initially displayed. You will find a drop down
select box that allows you to select any SamplerController you wish to use. When you make this
selection, the appropriate GUI will be displayed.
The SamplerController determines the basic kind of sampling you will do. Choose the "Advanced HTTP tester" for advanced web page sampling, and the "Simple HTTP Tester" for testing single web pages quickly, and choose the "JDBC Base Sampler" to sample your database.
The available SamplerControllers are (Click links for more detailed information):
Creating Test Samples
A test sample represents an entry to be sampled. It holds all the information needed about conducting a sample. For instance,
an
HTTPTestSample
might hold information about the
URL
to be hit, whether
POST
or
GET
is to be used, and what argument
name-value pairs should be passed on. The Test Sample will present a GUI for the user to enter this information.
Creating test samples is dictated by the workings of the SamplerController you chose. In general, the SamplerController
will display a list of test samples you've created, and you will be able to create more, and there may be different kinds
of test samples you can create. See the link for the SamplerController you are using to find out what test samples are
available to you and how to use them.
Choosing a delay
Delay represents the number of milliseconds JMeter pauses between samples in each sampling thread. There are a number of
delay modules you can choose from on the
setup
panel, and they should be mostly self-explanatory.
You may choose a timer for each thread group (actually, you must, or each thread group
will use the default timer).
Managing Thread Groups
Thread groups are managed in the
run
panel.
By default, there is only one thread group to start. It is called "Group 1". You may simply use this one group, or you
can add more groups by typing in the name of the group you wish to add above the list and hitting
Enter
. For
each thread group, you can choose a number of threads from 1 to 20 (this can be changed in jmeter.properties). There is no limit on the number of thread groups you
can have, except for the limitations of your machine, and how many threads it can handle.
The thread groups you add also become available as choices within your test samples you create. If you add a thread group (say
"Group 2"), and then, from the
setup
panel, you create a new test sample, you will notice that both Group 1 and Group 2
show up in your list of thread groups to choose from. A particular test sample may be part of one or more thread groups. This
allows you to set up two parallel groups of test samples that will execute simultaneously. The two test groups could, however, share
a common test sample, such as a one-time login sample.
Thread groups are also important to visualizers, since you may choose a different visualizer for each thread group.
Note:
if you are not clear on what "threadgroup" is referring to exactly, don't worry - you aren't alone. JMeter is no less
powerful a tool if you only ever use the single default threadgroup. You may use any number of threads in your default threadgroup
(by modifying jmeter.properties). Each thread represents a different "user" hitting your site. All test samples will be
assigned to the single default thread group automatically if you never create an additional thread group. JMeter 1.6 will
hopefull deal with this issue better.
Choosing a Visualizer
Visualizers are managed in the
run
panel in the section labeled
Actions
.
For each thread group, you may select a different visualizer. Visualizers show the timing data that JMeter collects during sampling.
As you select different thread groups, the visualizer display switches to the visualizer you selected for that thread group. In
this way, you can keep an eye on all your visualizers while JMeter runs.
Running the test script
Once you have chosen your sampler controller, created all your test samples, selected a delay, added any thread groups, and
selected your visualizers, you simply choose "start" from the "Run" menu, or hit
ctrl-s
. To stop, choose "Stop" from the "Run" menu, or hit
ctrl-.
. Switch to the
run
panel to watch it run.