WAPT 4.0
Home Product Features Updates Download Order Support Distribution SoftLogica
 
New Test Scenario Wizard
../Accurate real user simulation
Dynamic test data generation  
Recording & Playback of HTTPS/SSL pages  
Flexible test volume & load definition  
Clear reports and graphs  
Full log of virtual user activity  
 
WAPT: Load and Stress Testing

 Name:
 E-mail:

Subscribe to SoftLogica Newsletter to get 10% discount on newly released products!



 
  Go to Index
Working with Session Variables

There are two main methods of incorporating session variables into site pages:
  1. to incorporate session variables into URI
  2. to use request parameter to transmit session variable
WAPT supports both methods:
  1. using functions "URI from Form" and "URI from link"
  2. using functions "Hidden" and "Parameter from URL"
------------------------------------------------------------------------------------
Session variable is a part of URI
Functions "URI from Form" and "URI from link" cannot be used to define URI directly. You should create a variable based on one of these functions on the previous page and then use the variable to define URI.

URI from link - $HRef
Syntax:

VarName=$HRef({text})
Searches for the link with specified text in HTML code of response to the CURRENT request and returns the URI from this link.

Note:
If the link uses relative path, you should add the missing part of URI manually (see Example 2).

Example 1 (full path):

HTML code of response contains:
<A HREF="/scdp/page;jsessionid=u8kzzgzsr2">Preparing test scenario</a>

If you create a variable JSesID equal to $href(Preparing test scenario), you will obtain the actual URI with a new value of jsessionid. In this example, the variable will get the following value:

/scdp/page;jsessionid=u8kzzgzsr2
and you can set URI in the subsequent request to use the value of JSesID variable.

Example 2 (relative path):
HTML code of response contains:
<A HREF="/page;jsessionid=u8kzzgzsr2">Preparing test scenario</a>

The only difference is that you should use /scdp&$href(Preparing test scenario) instead of $href(Preparing test scenario).

URI from Form - $Action


Syntax:

VarName=$Action({index})
Searches for the form in response to the previous request and returns URI from the action attribute.
Index defines which occurrence of the form should be used (multiple forms on the page). 0 stands for random occurrence.

Note: If the link uses relative path, you should add the missing part of URI manually.
Example:

HTML code of response contains:
<FORM NAME="search" METHOD= "GET"ACTION="/cgi-bin/search.pl;SessionID=9071C43790244953739594949120B6C8">
<INPUT TYPE="text" NAME="text" VALUE="" MAXLENGTH=80>
<INPUT TYPE="submit" VALUE="Start search">
and this is the first form on the page.


If you create a variable URI_session equal to $action(1), you will obtain the actual URI from this form with an actual value of SessionID. In this example, URI_session variable will get the following value:

/cgi-bin/search.pl;SessionID=9071C43790244953739594949120B6C8 and you can set URI in the subsequent request to use the value of URI_session variable.

---------------------------------------------------------------------------------------------
Session variable is a request parameter
Functions $UrlParam and $Hidden can be used directly or using variables. Examples below show the direct usage of these functions.

Parameter from URL - $UrlParam
Searches HTML code of the PREVIOUS page for GET or POST request that contains the specified parameter and returns its value.

Syntax:

ParamName=$UrlParam({name},{index})
Index defines which occurrence of the specified parameter should be used (multiple forms with the same parameter). 0 stands for random occurrence.

Example 1:

HTML code of response contains:
<A HREF="http://myserver/view?SessionID=FCHHAB02DF&param=test111"></a>

The use of Myparam=$UrlParam(SessionID) in the next request will result in the actual value of Myparam=FCHHAB02DF.

Example 2:
You need to automate a simple scenario of navigating through a certain site using respective HTTP requests:

1. User registration:
http://myserver/register?User=Alex&Pass=qwerty (a POST request)

2. After registration, the user is redirected to the main category which displays links to all resources of the site. At this stage, the SessionID session variable is generated. The user selects the Main category by clicking the respective link:
http://myserver/view?SessionID=FCHHAB02DF&Category=main

3. The user selects a link to particular resource:
http://myserver/view?SessionID=FCHHAB02DF&Category=main&Item=67
During recording, WAPT records this sequence of HTTP requests, but the static value of SessionID would not be used to playback this sequence during test run. After sending the second request an error will occur. The reason is that we try to use the old value of SessionID.

You should set SessionID parameter to $UrlParam(SessionID) and thus solve problems related to SessionID.

------------------------------------------------------------------------------------------
Hidden - $Hidden
Returns the value of hidden parameter from HTML code of response to the PREVIOUS request.

Syntax:

ParamName=$Hidden({name},{index})
Index defines which occurrence of the specified parameter should be used (multiple forms with the same parameter). 0 stands for random occurrence.
The function searches for an element containing <.... name="{name}" value="{value}"> using the specified {name}. The found {value} will be used. Hidden input elements in HTML forms can be used, for example, to include session dependent values in request.

Example:
Response to the previous HTTP request contains a form with the set of hidden elements:

<form action="/cgi-bin/select.pl" method="get">
<input type="text" name="index" size="25" maxlength="25">
<input type="submit" value="Search">
<input type="hidden" name="UserSession" value="75893.0884568651DQADHfApHDHfcDtccpfAttcf">
....
....
</form>


To obtain UserSession value presented as a hidden input, you should set UserSession parameter to $Hidden(UserSession).
  Next page

Download
Download
Order Now


03/21/2006 WAPT successfully passed the 'Designed for Windows XP' certification by Microsoft(R)


People who buy WAPT also often purchase:
People who purchase WAPT also often purchase WSOP! Optimize your Website Loading Times
Better Together
Total list price: $347
Buy together: $297
 
Buy both Now!

SiftLogica
Revieved by BUILDER.COM  
  Copyright © SoftLogica LLC. 2002-2006     Contact: support@loadtestingtool.com