What is an HTTP request?

I will not write about HTTP protocol in general. I want to concentrate on few facts about HTTP requests that are important for load testing. As I mentioned in the previous post, when we work with a web site using a browser, all our actions produce HTTP requests that a sent to the server. Server replies to each of these requests. The browser uses these server responses to build each page that we see in its window. Some of the responses contain page text in form of HTML code, some contain images that we see on the page, and some carry additional data that is also used to display the page correctly.

Each HTTP request consists of 3 sections: request line, headers and body.

In WAPT you can take a look at any request in a raw form if you select it in the left view and choose the “Response processing” tab in the right view. In the lower part of the window you will see the request. It will look like this:

Raw Request

The request line begins either with “GET” or “POST” word. This is the method specification. There are other methods, but they are used for special purposes and do not usually appear in regular user sessions generated by browsers.

A GET-request is used to download a resource (page, image, etc.) from the server. POST-requests are used to pass some data to the server. They can contain form data, a file that should be uploaded, etc.

Method specification is followed by an URI (Uniform Resource Identifier). This is a string of text that we usually type in the address bar of a browser to get to a web page. Just the site name is stripped.

Both GET and POST requests can contain parameters. This is a very important part of request, because they are used to pass dynamic data. When two different users login to a web site, they do this by accessing same page and clicking the same button on it, but they provide different user names and passwords. As a result, same request is sent to the web site in each case, but it contains different values of parameters.

For GET-requests parameters are passed inside the URI after the “?” sign. This is an example:

GET /my_uri/page.asp?parameter_name1=value1&parameter_name2=value2

As you can see, each parameter has a name and a value, different ones are separated by “&”.

If POST method is used, parameters are passed inside the request body using the same notation.

Why is this important for load testing? To test a web site we need to emulate hundreds or even thousands simultaneously working users. We can record a single user session consisting of a sequence of requests. When running the test, we will use this sequence as a template for all our virtual users, but with small modifications: the values of some parameters will be different for each user. Of course, this is not always limited to just user names and passwords. In some cases the difference between the sessions of different users is much more complex.

In any case the above means that it is not sufficient to record a profile to run the test. After recording you need to specify how to calculate some parameters of requests for different virtual users. This is called parameterization.

Leave a Comment

Your email address will not be published. Required fields are marked *