
The use of "cookies" to save persistent state is an invention of Netscape
that was never made part of the HTTP specification. Never-the-less, cookies have been widely used and adopted by
most browsers. For more information about cookies and how they're used, you can read the original Netscape Cookie Specification, as well as visit
the Cookie Central web site.
Session Management
The most common use of cookies is to implement session management
in Servlets and Active Server Pages. These give a unique cookie
to each visitor to a web site, and provide an application programming
interface for identifying those users. Web Performance TrainerTM
automatically supports this use of cookies. When you record a
session with a web site, and there is no session identifier cookie,
the web server will issue a "set cookie" command. Each
virtual user will receive a separate command, and see to it that
every other request from the virtual user in that business case
will have the unique cookie specified by the web server. When
the business case is repeated, the new replay of the business
case will receive a separate cookie. This allows every repeat
of every business case to appear to the web server as a unique
user. Note that the virtual user count is the number of simultaneous
users, not the total number of users. This means if you run a
test with one virtual user for five minutes, and the business
case takes a minute to complete, your logs will show that five
users have accessed the system, even though the simulation was
for one virtual user.
Viewing Cookies
Web Performance TrainerTM gives you the ability to view any of the
pieces of data sent between a browser and the web server, including
cookies. To view the cookies in an HTTP request, select the URL
from URL Table on the Recording Tab, and then either double click
on the row, or execute Edit->Edit URL. This will bring up the
HTTP Request Editing Dialog. Click on "Cookie:" to view
the cookie values:

Setting Cookies
There are two ways of setting cookies. The most common way is
the web server sends a "set cookie" request to the browser.
A Web Performance TrainerTM virtual user responds to set cookie
requests in real time, behaving exactly like a browser. All subsequent
HTTP requests in a business case will contain the new cookie value.
The other way to set a cookie is
for JavaScript code running inside a browser to set a cookie.
Web Performance TrainerTM does not support this use of cookies because
doing so would require a runtime JavaScript interpreter for each
virtual user, greatly reducing the number of virtual users that
could be simulated by a single computer.

|