23.03.2013 Views

Agile Performance Testing - Testing Experience

Agile Performance Testing - Testing Experience

Agile Performance Testing - Testing Experience

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

HTTP-level tools record HTTP requests on the HTTP protocol level.<br />

They usually provide functionality for basic parsing of HTTP responses<br />

and building of new HTTP requests. Such tools may also<br />

offer parsing and extraction of HTML forms for easier access to<br />

form parameters, automatic replacement of session IDs by placeholders,<br />

automatic cookie handling, functions to parse and construct<br />

URLs, automatic image URL detection and image loading,<br />

and so on. Extraction of data and validation are often done with<br />

the help of string operations and regular expressions, operating<br />

on plain HTTP response data. Even if HTTP-level tools address<br />

many load testing needs, writing load test scripts using them can<br />

be difficult.<br />

Challenges with HTTP-Level Scripting<br />

Challenge 1: Continual Application Changes<br />

Many of you probably know this situation: A load test needs to<br />

be prepared and executed during the final stage of software development.<br />

There is a certain time pressure, because the go-live<br />

date of the application is in the near future. Unfortunately, there<br />

are still some ongoing changes in the application, because software<br />

development and web page design are not completed yet.<br />

Your only chance is to start scripting soon, but you find yourself<br />

struggling to keep up with application changes and adjusting the<br />

scripts. Some typical cases are described below.<br />

• The protocol changes for a subset of URLs, for example, from<br />

HTTP to HTTPS. This could happen because a server certificate<br />

becomes available and the registration and checkout process<br />

of a web shop, as well as the corresponding static image<br />

URLs, are switched to HTTPS.<br />

• The URL path changes due to renamed or added path components.<br />

• The URL query string changes by renaming, adding or removing<br />

URL parameters.<br />

• The host name changes for a subset of URLs. For example,<br />

additional host names may be introduced for a new group<br />

of servers that delivers static images or for the separation of<br />

content management URLs and application server URLs that<br />

deliver dynamically generated pages.<br />

• HTML form parameter names or values are changed or form<br />

parameters are added or removed.<br />

• Frames are introduced or the frame structure is changed.<br />

© iStockphoto.com/brinkstock<br />

Load <strong>Testing</strong> Web Applications –<br />

Do it on the DOM Level!<br />

by Ronny Vogel<br />

• JavaScript code is changed, which leads to new or different<br />

HTTP requests, to different AJAX calls, or to a new DOM (Document<br />

Object Model) structure.<br />

In most of these cases, HTTP-level load test scripts need to be adjusted.<br />

There is even a high risk that testers do not notice certain<br />

application changes, and although the scripts do not report any<br />

errors, they do not behave like the real application. This may have<br />

side effects that are hard to track down.<br />

Challenge 2: Dynamic Data<br />

Even if the application under test is stable and does not undergo<br />

further changes, there can be serious scripting challenges due<br />

to dynamic form data. This means that form field names and values<br />

can change with each request. One motivation to use such<br />

mechanisms is to prevent the web browser from recalling filledin<br />

form values when the same form is loaded again. Instead of<br />

„creditcard_number“, for example, the form field might have a<br />

generated name like „cc_number_9827387189479843“, where the<br />

numeric part is changed every time the page is requested. Modern<br />

web applications also use dynamic form fields for protection<br />

against cross-site scripting attacks or to carry security-related tokens.<br />

Another problem can be data that is dynamically changing, because<br />

it is maintained and updated as part of the daily business.<br />

If, for example, the application under test is an online store that<br />

uses search-engine-friendly URLs containing catalog and product<br />

names, these URLs can change quite often. Even worse, sometimes<br />

the URLs contain search-friendly catalog and product names,<br />

while embedded HTML form fields use internal IDs, so that there<br />

is no longer an obvious relation between them.<br />

Session IDs in URLs or in form fields may also need special handling<br />

in HTTP-level scripts. The use of placeholders for session IDs<br />

is well supported by most load test tools. However, special script<br />

code might be needed, if the application not only passes these<br />

IDs in an unmodified form, but also uses client-side operations on<br />

them or inserts them into other form values.<br />

To handle the above-mentioned cases, HTTP-level scripts need<br />

manually coded, and thus unfortunately also error-prone, logic.<br />

Challenge 3: Modeling Client-Side Activity<br />

In modern web applications, JavaScript is often used to assemble<br />

URLs, to process data, or to trigger requests. The resulting<br />

requests may also be recorded by HTTP-level tools, but if their<br />

20 The Magazine for Professional Testers www.testingexperience.com

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!