Skip to main content

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.

image

As shown in the screenshot below, the test plan contains two HTTP requests recorded using the JMeter HTTP Proxy component and four JMeter Regular Expression Extractors in between them.:

image

The main trick here is to capture four key MOSS fields from the HTTP response of the “Load Edit Property From” HTTP request and send them back to the server AS IS in the “Submit Edit Property From” HTTP request along with new property values. These key fields are:

  1. __EVENTVALIDATION
  2. __VIEWSTATE
  3. __REQUESTDIGEST
  4. <control ID>_owshiddenversion 

Load Edit Property Form

The Load Edit Property Form step is a simple JMeter HTTP Sampler generated by running the JMeter HTTP Proxy component and recording the HTTP request created by click on the Edit Properties menu item in the SharePoint drop down.

 image

The response from the MOSS server will contains the four key fields that can be captured using JMeter Regular Expression Extractors.

Extract Event Validation

Regular Expression:

id="__EVENTVALIDATION" value="(.+?)"

Screenshot:

image

Extract View State

Regular Expression:

id="__VIEWSTATE" value="(.+?)"

Screenshot:

image

Extract Request Digest

Regular Expression:

id="__REQUESTDIGEST" value="(.+?)"

Screenshot:

image

Extract Hidden Version

This one is not so straight forward as the other three because the <Control ID> changes from page to page depending on the layout. It can be found by simply searching the string “owshiddenversion” in the HTML source for the edit property page. The HTML tag should look something like this:

<input id="ctl00_m_g_026c19e0_cd4b_48c9_a4b3_9e7409f252ac_ctl00_ctl02_ctl00_ctl05_ctl00_owshiddenversion" type="hidden" value="15" name="ctl00$m$g_026c19e0_cd4b_48c9_a4b3_9e7409f252ac$ctl00$ctl02$ctl00$ctl05$ctl00$owshiddenversion" />

Hence, the regular expression in this case is:

id="ctl00_m_g_026c19e0_cd4b_48c9_a4b3_9e7409f252ac_ctl00_ctl02_ctl00_ctl05_ctl00_owshiddenversion" value="(.+?)"

and the screenshot:

image

Submit Edit Property Form

The “Submit Edit Property Form” JMeter HTTP sampler is generated by recording the Submit button click using the JMeter HTTP Proxy component. JMeter displays all POST parameters contained in this request.

image

The Reference Names of the four keys fields (e.g. ${viewState} as shown in screenshot above) captured previously need to be entered into their corresponding parameter value fields. My test script also updates other parameters such as author and title for my testing purpose.

Comments

  1. great! i need to test an asp.net app, i'll give it a try!!

    ReplyDelete
  2. This was very useful to me, and gave me just a little more appreciation of how hairy Sharepoint is beneath the pretty surface.

    ReplyDelete
  3. Greate work...! is there an any way to parameterize the values. e.g. - Name, Title, Auther, Category.

    ReplyDelete
  4. Yes you can parameterize values by either extracting them from a HTTP response with extractor or setting user variables. You can even get JMeter to read all your test values from a CSV file. Check out the JMeter manual at http://jakarta.apache.org/jmeter/usermanual/test_plan.html#using_variables

    ReplyDelete
  5. Thanks so much for this. Clearest explanation I've found on the web.

    ReplyDelete
  6. Has anyone managed to get JMeter to work with a site that has NTLMv2 authentication?

    ReplyDelete
  7. to use NTLMv2 you have to add authorization compenent on Jmeter

    ReplyDelete
  8. 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

Post a Comment

Popular posts from this blog

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.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:

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…