Load Testing by
Example
Customizing User Input
Overview
This tutorial demonstrates
configuration of a
typical testcase to use a unique
identity
(username/password) for
each virtual user (a.k.a. VU or simulated user) in prepration
for load testing. For demonstartion purposes, a testcase will be created using
the SugarCRM open source web application.
However, the procedure will be nearly identical for any web-based
system in which the user enters values into form fields on a
web page.
Prerequesites: This guide assumes a
basic
understanding of the Load Tester product. The
Load
Tester videos are a good introduction to the main features.
It is
assumed you have recorded a testcase.
Please
note that
this tutorial is based on Load Tester 3.5. The procedure is similar in
other versions, but the details may vary slightly.
About
the testcase
The testcase used for this tutorial is the
Add User testcase
from the
Load
Testing SugarCRM tutorial. It is explained in detail there.
Here we are primarily interested the step in the testcase where the
administrator fills out the required fields for creating a new user. As
shown below, the administrator completes five fields when creating a
new user.
In
order to simulate this testcase properly, particularly during a load
test, the data in the HTTP request that corresponds to these form
fields must be different each time the testcase is repeated. If the
field values were not different, the server would return an error since
a new user cannot be created with the same username as an existing user.
Providing
the field values
Before configuring the fields to
use differnt
values, there must be a source for these values. In Load Tester,
this is called a dataset. The process of creating a dataset is
explained in the
Creating
a
dataset tutorial. For this testcase, a dataset with four
fields is
required, such as this:
The
settings on the dataset will control how long a row from the
dataset is used. In this example, where the fields are all used on a
single page, setting the dataset
Lifespan
to
Web Page
is the correct
choice. Since duplicate users are not allowed, the
Reusable property
should be
disabled as well.
Configure
Fields
To view the fields in the testcase, select the
Fields view. Then
select the page
after
the page that shows the fields
to be entered.
This can be very confusing to
testers who
are new to
load testing - a more detailed explanation may help: Load
Tester simulates users at the HTTP layer - where it is primarily
concerned with HTTP requests from the browser and the corresponding
responses from the server. The
Fields
view shows the fields that are
sent
to the server in a request. When you are looking at a web
page
and typing in form fields, these fields were defined in a response from
the server. It is not until the next request to the server (e.g. when
the
Submit
button is pressed)
that the fields and the entered values appear in an HTTP transaction.
In the example below, the content view for page
SugarCRM...[5]
would show the
fields we displayed above - where the user will enter the user name,
password, etc. It is not until the request for page
SugarCRM...[6] that
the values
entered by the user are sent.
Once that page is
selected,
the fields for the page are displayed in the fields view, as shown
below. If no pages in the testcase editor are selected, all fields for
the testcase will be displayed. You may also select the testcase in the
navigator to view all the fields without opening the testcase editor.
The
picture shows two of the fields - the first and last names. The remaing
fields are farther down the list.
Selecting a
field (row) in
the table will enable the Edit button in the upper-right corner of the
view. Pressing this button will invoke the
Configure fields...
dialog. The
dialog may also be opened by double-clicking in the modifier column
(M?) for the field.
To
replace the recorded value of this field dynamically when the testcase
is replayed (in this case, the
first_name
field)
- Select the Dataset
option
- Select the name of the desired dataset in
the DataSet
choice box
- Select
the name of the desired field in the Field
choice box
- Press
the OK
button
In our
example, we will need to do this five times - for the first name, last
name, username and 2 password fields.
When this
testcase is
replayed, each of these fields will use a value from the dataset. Note
that when the last row from the dataset has been used, the next VU to
attempt the page will fail with an
Out
Of Data error because the dataset is not reusable.
Conclusion
Using
datasets and the
Fields
view,
customizing user inputs can be completed in only a few minutes.
Feedback & Comments
Comments about this report may be posted at the company blog post.
About
Christopher L Merrill
©2007 Web Performance, Inc.; v1.1
Version
History
v1.0 - 1st public release (13 September 2007)
v1.1 - email cleanup (23 Jan 09)