How do I simulate the usage of a sequence of web pages?
- by Rory Becker
I have a simple sequence of web pages written in ASP.Net 3.5 SP1.
Page1 - A Logon Form.... txtUsername, txtPassword and cmdLogon
Page2 - A Menu (created using DevExpress ASP.Net controls)
Page3 - The page redirected to by the server in the event that the user picks the right menu option in Page2
I would like to create a threaded program to simulate many users trying to use this sequence of pages.
I have managed to create a host Winforms app which Launches a new thread for each "User"
I have further managed to work out the basics of WebRequest enough to perform a request which retrieves the Logon page itself.
Dim Request As HttpWebRequest = TryCast(WebRequest.Create("http://MyURL/Logon.aspx"), HttpWebRequest)
Dim Response As HttpWebResponse = TryCast(Request.GetResponse(), HttpWebResponse)
Dim ResponseStream As StreamReader = New StreamReader(Response.GetResponseStream(), Encoding.GetEncoding(1252))
Dim HTMLResponse As String = ResponseStream.ReadToEnd()
Response.Close()
ResponseStream.Close()
Next I need to simulate the user having entered information into the 2 TextBoxes and pressing logon.... I have a hunch this requires me to add the right sort of "PostData" to the request. before submitting.
However I'm also concerned that "ViewState" may be an issue.
Am I correct regarding the PostData?
How do I add the postData to the request?
Do I need to be concerned about Viewstate?
Update: While I appreciate that Selenium or similar products are useful for acceptance testing , I find that they are rather clumsy for what amounts to load testing.
I would prefer not to load 100 instances of Firefox or IE in order to simulate 100 users hitting my site.
This was the reason I was hoping to take the ASPNet HttpWebRequest route.