Automatically Resolve Session Identifiers using a Model

Use a model to automatically manage all the session identifier of your script.

By default, AgileLoad offers models for several application types:

The features relating to models can be accessed from the AgileLoad Script Editor "Tools" toolbar

  • The Drop-down list is used to select a model.
  • The "Configure Selected Model" creates or modifies models.
  • The "Apply Model" applies the selected model to the current script.
  • The "Find Next Pattern" highlights the next pattern in script matching a rule in the selected model.
  • The "Find Previous Pattern" highlights the previous pattern in script matching a rule in the selected model.

When a model is created, it can be applied to a script by:

  1. Selecting it from the model drop-down list located in the toolbar.
  2. Clicking the icon or by selecting the "Tools/Model/Apply Current Model" menu option.

When AgileLoad Script Editor manages session identifiers, it:


 

Configuring Models

A model is made up of a list of rules.
A rule describes how to locate and resolve HTTP requests containing a of session identifier.

To configure a model, click the located in the AgileLoad Script Editor toolbar or select the Tools/Model/Configure... menu option.
The following dialog box will open:


 

"Search in Script" tab

This tab view describes how to locate a session identifier in a script. The session ID can be a Variable or can be located in a URL.



Variables

A session ID is a variable if it has the following format: name=value.

Form variables A variable is a Form variable if it is specified after a '?' character and right delimited by the '&' character or if it is contained in the body of a POST request (using the "Content-Type: application/x-www-form-urlencoded" HTTP header) 

eg:
    http://www.agileload.com/home.php?sessionid=123456&name=john
Non Form variables A variable is a Non Form variable if it has a left delimiter different than '?' and a right delimiter different than '&'.

eg:
    http://www.agileload.com/home.php;jsessionid=123456?name=john
    http://www.agileload.com/home.php$type=123456

Specify the variable name in the Name field. Check the "Form" check box if the variables is a form variable.

You can specify the variable name using a regular expression (eg: "jsession.*"). In that case, the Reg. Exp option must be selected.
 

The variable name will be searched in the script and in response data. You can specify a different variable name when searching in response data. Check "Alias" check box and specify the variable name. You can already specify the variable name using a regular expression.
 

Substr

Choose the Substr option if the session ID is not a variable and is contained in:

The options to locate the identifier are descibed in "Extracting a web page content using delimiters".

Example : add a rule to manage the "projectUid" identifier in a SOAP/XML http request:

SUBMIT POST "http://raonaepm/pwa/_vti_bin/PSI/project.asmx" IDENTIFIER 159 REFERER 99
BODY
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
"<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">"
    "<soap:Body>"
        "<QueueCheckInProject xmlns=\"http://schemas.microsoft.com/office/project/server/webservices/Project/\">"
            "<projectUid>{f84bffc3-098d-4702-a727-55df1c60b5d7}</projectUid>"
            "<force>false</force>"
            "<sessionUid>{bef3f8e7-39ad-4a69-bb40-cab4f32ea45a}</sessionUid>"
            "<sessionDescription>Check in project from PWA Team Builder</sessionDescription>"
        "</QueueCheckInProject>"
    "</soap:Body>"
"</soap:Envelope>";
 

The projectUid parameter is :

  • a session identifier

  • located in the request BODY

  • located between the "<projectUid>{" left delimiter and the "}" rigth delimiter

  • the left and right delimiters are not contained in the identifier

The configuration must be set as following:

Custom URL

The character strings of the session IDs are sometimes characterized by their:

In the previous HTTP request example, the session ID "345dR32-1fD34a2342533493v2":

"Search in Data" tab

This tab view describes how to locate the session identifier value in the http responses.

There are 6 ways to locate a session identifier:

formvalue Check formvalue to search the session identifier in a HTML FORM value.
location Check location to search the session identifier in a "location" HTTP header (eg: URL rewriting)
setcookie Check setcookie to search the session identifier in a "Set-Cookie" HTTP header
link Check link to search the session identifier in HTML Urls
header Check header name to search the session in a header value
text Check text to locate the session identifier using a "pattern matching" method.
custom If none of the methods described above automatically finds the session identifier, you can describe a custom way to locate it.

The formvalue, header, location, setcookie, link and text search types are automatically added when a new rule is created. The modeling engine will search the session identifier using the search types described in the list until one of them is satisfied.


Search types can be reordered using the arrow icons of the toolbar.
If a search type is not relevant, it can be disabled (uncheck the check box located on the left hand side of the search type).

If the "Find Nearest" option is checked, the modeling engine will search the origin of the session id beginning by the web request located just before the web request which uses the session id. If the "Find Nearest" option is not checked, it will search the origin of the session id beginning  by the first web request of the script.

custom search type

If none of the formvalue, location, setcookie, link and text methods automatically finds the session identifier, you can describe a custom way to locate it.

  1. Click the icon. A new custom search type is inserted in the list
  2. Click the "..." button to edit it; the "Custom search" dialog is opened (see "Extracting a web page content using delimiters" for a description of this dialog box).


     
  3. A QNI function call can be also generated in the script to modify the extracted session identifier value. Check the "Add Extract function" and specify the function name and the QNI dll name.

"Replace by" tab

Specify a variable name prefix or an expression which will replace the session identifier in the script.


 

In the screenshot above, the "VIEWSTATE" variable prefix is specified. The session identifiers will be replaced by variables with the following name format: VIEWSTATE_x_QT.

HTML_SetFormValue(F, "__VIEWSTATE", "" + VIEWSTATE_2_QT );
HTML_SetFormValue(F, "btnSubmit.x", "60");
HTML_SetFormValue(F, "btnSubmit.y", "6");

SUBMIT POST PRIMARY "http://proxima/MSpetshop/SignIn.aspx" IDENTIFIER 23
    URLENCODED_FORM F;
 

In some cases, a session identifier need to be replaced by an expression. For example, the "SWETS" rule of the "Siebel" model is configure to replace the SWETS form variable by the "GetDate" function. When the "Expression" option is selected, the "Search In data" options are ignored.

Create a new Model

To Create a new model, click the New button and specify a model name in the opened dialog box:



The new model is added to the Model drop-down list.
 

The Session ID Manager view

The session ID manager section shows a list of all the session ID values which have been replaced by variables.

Click the "Clear List" button, located on the upper right side of the Session ID Manager section, to remove all entries from the list.


Locate the Modified HTTP Request

Double-click on a line or select the "Goto statement" item from the contextual menu; it highlights the corresponding HTTP request in the script.
 

Locate the HTTP Request Containing the Original Session ID Value

1. The parent request has been found:

If the Parent Request ID column contains a value, select the Goto Parent item from the contextual menu; it highlights the HTTP request from which the session ID is extracted.


2. The parent request has not been found:

In some cases (ex: the session ID is generated by a javascript function), the session ID manager cannot automatically locate the origin of a session ID.  In this situation, the  icon is displayed on the left side of the message line and the "Parent Request ID" value is '-'. Select the "Find in HTTP responses" from the contextual menu to manually locate the HTTP requests that contain the session ID in their response.



The "Find in HTTP" dialog is opened and contains the session ID value to search.



Click "OK". The HTTP requests are listed in the Find In HTTP tab.

See also:

 





Go back to the Learning center:


Copyright © AgileLoad. All rights reserved.
Agile Load testing tool| Contact AgileLoad | Terms of Use | Sitemap