Following my previous post about using JMeter to test MOSS, I tried to figure out what are the bare minimum requirements of using JMeter against a plain ASP.NET website.
I wrote a very simple ASP.NET web application with just a button, a text fields and a static label. This application displays the content of a text file in the static label when it loads and write content of the text field back to the file when the button is clicked.
I found all I need to do in order to script this using JMeter is to extract __VIEWSTATE and __EVENTVALIDATION fields then send them back in the update request. My JMeter test plain looks like this:
Great Article, I have one question.
ReplyDeleteHow can you make Jmeter click the button?
Hi,
ReplyDeleteNope you can't, all JMeter does is record and play back HTTP traffic. You will need to use selenium (http://seleniumhq.org/) for something like that.
Cheers,
Oscar
Hi Oscar,
ReplyDeleteI actually was able to "click" the button in jmeter.
1. Run the page once and view the HTM source to obtain the viewstate information and eventvalidation.
2. Disable your steps for 'Extract Event Validation" and "Extract View State"
3. In the Http request sampler for your page, change the method to "Post" and in the "send parameters with the request" section add the follwing parameters:
Name/Value
__VIEWSTATE/copy your viewstate and check the encode button
__Eventvalidation/copy your event validation and check the encode button
TextBox1/"leave empty"
Button1/Click+Me
In my sample which is similar to yours I will see in the View Results tree my Http response 200 and the value "Hello world" in the resulting html for the textbox.
Rich aka anonymous
Hi Rich,
ReplyDeleteThanks for the info, that's pretty cool.
Cheers,
Oscar
Hi Oscar,
ReplyDeleteI tried to enable click event according to Rich's procedure. But I can't. Any suggestion?
Note: I didn't find any __Eventvalidation in the page i tried.
--Nazia
Hi Nazia,
ReplyDeleteI never tried Rich's idea out myself so you might have to figure it out yourself, sorry.
Are you testing a classic ASP.NET or an ASP.NET MVC application? The __EventValidation property is only for classic ASP.NET, you won't have that if you are testing an ASP.NET MVC app.
Oscar
Thank you for this post. It has help me as a VERY Newbie to JMeter!
ReplyDelete-Franklin
will jmeter supports asp.net,C# and https environments pls....
ReplyDeleteHi,
ReplyDeleteJMeter is agnostic of server side programming language since it operates at browser level, so yes it will work with C# and I've showed you how to use it with ASP.NET.
As for HTTPS, JMeter does support HTTPS but you need to do some extra configuration as described here: http://jmeter.apache.org/usermanual/get-started.html#opt_ssl.
Oscar