August 23, 2010

Working with Session Variables in QA Wizard Pro Load Testing

Helix ALM
When working with web applications that use things like session variables, you need to modify your load script to accommodate these dynamic values. To show you how this works, I will use a web application developed in ASP.Net  Many web applications created in ASP.Net use view state, which  is used to persist states across postbacks. QA Wizard Pro has a great way to work with view state and other session variables that an application might be creating. In this example, the ASP.Net web application creates a number of session variables that I will need to specify in the load script to ensure the web server sees the load tests as valid commands to the web server. After recording a basic load script, I add the following statements to the beginning of the script after the 'SetLoadTestContext' statement:
WebAddSessionVariable("__EVENTTARGET") WebAddSessionVariable("__EVENTARGUMENT") WebAddSessionVariable("__VIEWSTATE") WebAddSessionVariable("__EVENTVALIDATION")
The WebAddSessionVariable statement ensures QA Wizard Pro retrieves the session variable value and persists with this value for the duration of the script. This also ensures the web server receives a valid session value during the load test execution. Session variables, which are not unique to ASP.Net applications, are common in many other web programming languages. The same basic statement will apply to any session variable values you need to using during a load test on any web application.