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:

Installing the WTL Application Wizard in Visual C++ 2008 Express Edition

I love Google Chrome, it is fast, elegant and beautiful. After I realized that it was written using WTL, I felt quite keen to learn about this library.I downloaded WTL 8.0 from SourceForge.net and Visual C++ 2008 Express Edition from Microsoft.com only to realise that there is no WTL Wizard support for Visual C++ 2008 Express Edition. WTL 8.0 ships with WTL/ATL application wizard but the setup script only supports the Visual C++ 2005 Express Edition (setup80x.js). However, the good news is that you can make it work with Visual C++ 2008 Express Edition in few simple steps:Make a copy of the setup80x.js and rename it to setup90x.js. Open setup90x.js up and do a global search and replace from “8.0” to “9.0”.
Save the file and execute it. If you are as lucky as I am, you should see a dialog that tells you that the wizard has been successfully installed.Now, when you run Visual C++ 2008 Express Edition and go File –> New –> Project… you should now see the new WTL/ATL Application…