| || |
Performance Testing: Session IDs
I'm currently working on a Load Test script for a web based application.
The application assigns the user a session ID once logged in, this is transmitted via the body of the login connection response.
Every subsequent GET request is required to contain the session ID at the end of the URL. e.g. www.website.com/new_page/?sessionID=001
I'm trying to find a way to:
Login and capture the session ID
Write the captured session ID back into other connections
I tried a piece of code that takes the sessionID from the login connection and places it in the GET string of another. The problem with that was the ResponseBody of the login connection was not updating with the live data, it just had the sessionID from when I first recorded the connection.
Here is a sample of the code I used:
<font class="small">Code:</font><hr /><pre>
login = httpTask.Connection(0).Request(0);
ndpID = login.ResponseBody.Contents;
lookup.URLVariables.Item("GET") = "/index/vehicle-details/id/201089?NDP=" + ndpID;
(ndpID is the session ID)
Re: Performance Testing: Session IDs
[ QUOTE ]
The problem with that was the ResponseBody of the login connection was not updating with the live data
[/ QUOTE ]
The actual server response is available only in the OnLoadTestingResponse event handler. In other places you will always get the recorded response body contents.
As for changing the sessionID value, you can do this in the OnLoadTestingRequest event handler.
For more information, see the "Checking Server Response" help topic.