Skip to main content

Load Testing ASP.NET Sites with JMeter

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.

image

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:

image

image

image

image

Comments

  1. Great Article, I have one question.

    How can you make Jmeter click the button?

    ReplyDelete
    Replies
    1. You can click button with WebDriver Sampler, which is Selenium based plugin for Jmeter. But you should note that Selenium is not for load testing and it's not recommended to use WebDriver sampler with more than 10 users.

      Delete
  2. Hi,

    Nope 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

    ReplyDelete
  3. Hi Oscar,

    I 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

    ReplyDelete
  4. Hi Rich,

    Thanks for the info, that's pretty cool.

    Cheers,
    Oscar

    ReplyDelete
  5. Hi Oscar,
    I 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

    ReplyDelete
  6. Hi Nazia,

    I 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

    ReplyDelete
  7. Thank you for this post. It has help me as a VERY Newbie to JMeter!

    -Franklin

    ReplyDelete
  8. will jmeter supports asp.net,C# and https environments pls....

    ReplyDelete
  9. Hi,

    JMeter 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

    ReplyDelete
  10. Excellent Post. Also visit http://whiteboxqa.com/#performance.php

    ReplyDelete
  11. How can I create JMeter scenario for testing ASP.NET pages - default page is login page with "Username" and "Password" fields (for entering username/password values) and [Login] button.
    These field are named in web form like "tbUsername", "tbPassword" and "btLogin".
    Firstly I need observe value "__VIEWSTATE" (from default page before login process) (is possible to use previous advance in this article), and values "__EVENTTARGET" and "__EVENTARGUMENT".
    And then?
    Have somebody some tips (or sample jmx-file)?

    ReplyDelete
    Replies
    1. I believe that ASP.NET Login Testing with JMeter guide has all the necessary explanations, workarounds and examples on correlating mentioned dynamic mandatory parameters

      Delete

Post a Comment

Popular posts from this blog

Load Testing SharePoint (MOSS) Sites with JMeter

I have used JMeter for load testing few non-ASP.NET web sites before, however I could not get it to work with ASP.NET web sites. This is mainly due to ASP.NET ViewState and event validations, which stops a recorded JMeter script from being played back.Recently I worked on a MOSS project and we were looking for tools to perform load testing on the server. Many people said the load testing tool in Microsoft Team System for Testers works well with MOSS. However, it is quite expensive so I decided to give JMeter another go. After several hours of hacking, I actually got it to work and here’s how I did it.My test page is the pretty standard MOSS edit document property screen with few extra text fields added and the goal here is to use a JMeter script to change the document properties. Once I have a working script, I can configure JMeter to fire hundreds of instances of this script simultaneously to simulate the user workload.As shown in the screenshot below, the test plan contains two HTTP…

Getting HP Mini 1000 Wireless to Work Under Ubuntu 9.10 Karmic Koala‎ Netbook Remix

I installed Ubuntu 9.10 Netbook Remix in my (actually my wife's) HP mini 1000 this afternoon. To my surprise the wireless card did not work. Also, when I looked at System -> Administration -> Hardware Drivers, the list was blank.After few hours of googling and reading through several not too helpful forum posts, I learned that this was caused by Ubuntu 9.10 shipping "b43" driver out of box, which does not work for HP mini 1000. The proprietary driver "wl" should be used instead. However, no one said exactly what I needed to do to fix this problem.Eventually, I decided to just launch Synaptic and search for "broadcom". The first result in the filtered list was bcmwl-kernel-source, which looked promising so I just went ahead and installed it.I had a look at the /etc/modprobe.d folder after the installation finished, I noticed that the package actually created a blacklist file for "b43" related modules for me already. After reboot, my wir…