Click here to Skip to main content
Click here to Skip to main content
Go to top

Performance testing ASP.Net applications with Microsoft Application Center Test

, 6 Jun 2006
Rate this:
Please Sign up or sign in to vote.
An article on using Microsoft Application Center Test (ACT) to test the ASP.Net Apps

Sample Image - ACTNet.jpg

Introduction

This article explains the working of an application/utility  that enables Microsoft ACT test ASP.Net applications.

Background (optional)

Microsoft Application Center Test (ACT) is quite simple and a nice tool to test the web applications' performance. It lets the user record a session and then through vbscript generation it enables the user test the application simulating the real world environment (controlling number of users, concurrent sessions etc). But for ASP.Net applications, there is a problem with ACT ver 1.0 that it does not support ASP.Net applications because primarily ACT was developed for ASP/generic html applications and it lacks the functionality to handle the ASP.Net viewstate. Nevertheless, there is a workaround that makes it possible using ACT for ASP.Net application testing but it requires manual editing of the vbscript code. This article describes a utility that automates the task of manual editing and make it simple for the developers/testers to modify the ACT vbscript code. Users just need to copy the ACT generated code into the ACT.Net conversion utility application and it gives back the code that can be used in Microsoft ACT to test the ASP.Net application.

Using the code

Well, basically you won't need to do much with the code, you can simply download the demo application and use it to convert the vbscript code to make it support ASP.Net application testing.

Following are the steps to follow in order to use the demo app.

Instructions:

1. Record a test in Microsoft ACT.

2. Copy the vbscript from the ACT recorded Test.

3. Paste the text in the "Source"text field in ACT.Net Conversion utility

4. Press Convert

5. Once it shows complete, click on "Output"

6. Copy the script and then paste it back to the ACT test. (Alternatively you can create a new blank test and paste it).

7. There is a limitation in Microsoft ACT, it doesn't allow you paste very large scripts. To overcome this problem, access the {testname}.vbs file (in your ACT project folder) through your browser and open in notepad/wordpad. Paste the new script and then save it. Reload the project in Microsoft ACT.

8. Run the test!.

9. There is a possibility that you may get some errors with the function Mid(..,..). It happens when the viewstate size is very large. To resolve this issue, repeat steps 3-7 with an increased buffer size (300000 or more).

For those who are interested in the code (or may like to make some of thier own changes to the generated code) here I explain how the application works

The code is pretty simple to understand. What it does that it updates the vbscript code generated by Microsoft ACT by inserting variable declarations, setting the request/response buffer size to hold the entire viewstate, storing the viewstate data in a variable and in the next request appending that data, stored in the variable, to the request object.

			// declare the text to be isnerted
			// we need to locate the following line of codes and then replace them with the new code that supports ASP.Net viewstate
			System.String searchCode = "strStatusCode = oResponse.ResultCode";
			
			// nees to set the buffer size large enough to hold the viewstate (in response object)
			System.String searchCode2 = "Set oResponse = oConnection.Send(oRequest)";
			System.String manualCode2 = "oRequest.ResponseBufferSize = "+this.txtBuffer.Text   +Environment.NewLine+"        Set oResponse = oConnection.Send(oRequest)";
			
			// need to declare two variables
			System.String searchCode3 = "fEnableDelays = False";						
			System.String manualCode3 = "fEnableDelays = False "+Environment.NewLine+"Dim strViewState "+Environment.NewLine+"Dim Pos1, Pos2	";
			
			// this piece of code will be injected to the vbscript to search the viewstate data in the response text and then extract and store it in strViewstate variable. 
			// this strviewstate will be used in the next request to send the data back to the server
			manualCode.Append("	strStatusCode = oResponse.ResultCode "+Environment.NewLine+"	' Manual Code injection- begin"+Environment.NewLine);
			manualCode.Append("	If InStr(oResponse.Body, \"__VIEWSTATE\") Then"+Environment.NewLine);
			manualCode.Append("		Pos1 = InStr(InStr(oResponse.Body, \"__VIEWSTATE\"), oResponse.Body, \"value=\")"+Environment.NewLine);
			manualCode.Append("		Pos2 = InStr(Pos1, oResponse.Body, \">\")"+Environment.NewLine);
			manualCode.Append("		strViewState = Mid(oResponse.Body, Pos1 + 7, Pos2 - Pos1 - 10)"+Environment.NewLine);			
			//manualCode.Append("		Test.Trace \"StrViewState After extract:= \" + strViewState "+Environment.NewLine);
			manualCode.Append("		' Manually encode viewstates:"+Environment.NewLine);
			manualCode.Append("		' Replace all occurrences of \"+\" with \"%2B\""+Environment.NewLine);
			manualCode.Append("		strViewState = Replace(strViewState, \"+\", \"%2B\")"+Environment.NewLine);
			manualCode.Append("		' Replace all occurrences of \"=\" with \"%3D\""+Environment.NewLine);
			manualCode.Append("		strViewState = Replace(strViewState, \"=\", \"%3D\")"+Environment.NewLine);
			manualCode.Append("	End If"+Environment.NewLine);
			manualCode.Append("	' Manual Code injection- end\""+Environment.NewLine);
			modifiedCode.Append(this.txtSource.Text);	

Finally do the insertion/replacements
			
			modifiedCode.Replace(searchCode3, manualCode3);
			modifiedCode.Replace(searchCode2, manualCode2);
			modifiedCode.Replace(searchCode, manualCode.ToString());

 

History

Initial: 06/06/06. Hassan Syed Last updated on : 07/06/06. Hassan Syed <!------------------------------- That's it! --------------------------->

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Hassan Syed
Web Developer
Australia Australia
Working with a consulting company,
MCSD guy

Comments and Discussions

 
GeneralAnother problem Pinmembertkrafael_net8-Jun-06 3:30 
GeneralRe: Another problem Pinmemberthompsonson27-Jul-06 1:01 
This is something I am interested in too. I've not really had any time to look into though.
 
I think it may be possible to run these tests on a machine without ACT installed. Most likely you will need to register the COM objects the scripts use. Here's a couple of links i've got in my todo list...
 
The Application Object Model
 
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/act/htm/actml_nav_apom.asp[^]
 
The Test Object Model
 
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/act/htm/actml_nav_omr.asp[^]
 
Would be interested to hear any thoughts/expereinces you have with this.
 
Cheers,
Matt
 

GeneralThose problems Pinmembertkrafael_net8-Jun-06 3:28 
GeneralRe: Those problems PinmemberHassan Syed8-Jun-06 14:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web04 | 2.8.140916.1 | Last Updated 6 Jun 2006
Article Copyright 2006 by Hassan Syed
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid