Application Lifecycle Management – Load Testing SharePoint Solutions

Introduction

“How does your solution scale with real user load as opposed to running on your local machine?”

In this and future blog posts we will look at how ALM and the tools that MS provides support us in ensuring high quality solutions. Specifically, we explore a few different types of testing and how they relate to our SharePoint solutions.

  • Manual Tests
  • Load Tests (this post)
  • Code Review/ Code Analysis
  • Unit Tests
  • Coded UI Tests

Load Tests are usually targeted at the application environment. In our case usually the SharePoint Web Servers, Application Servers and Database Servers. But they can also target your custom solution itself by running against pages containing application or business logic. I use them to:

  • Validate a system or system configuration against a base-line or set of requirements.
  • Determine if a system or solution operates within specified boundaries (the “Green Zone”).
  • Look for potential problems (memory leaks, etc.) or issues regarding scalability or capacity.

First a disclaimer: this post is just to get you started with Web Performance and Load Testing your SharePoint solution using Visual Studio. It does not cover any recommendations on pass/ fail criteria or guidance on how to interpret the test results!

Web Performance and Load Test

Visual Studio contains a project type you can use to design, execute, monitor and report on your Load Tests. This project type is called “Web Performance and Load Test Project” and is currently only available through the VS 2012 or VS 2013 Ultimate Edition. See http://www.microsoft.com/visualstudio/eng/products/compare for more information.

l1

Within this project type you will find two main components: Web Performance Tests and Load Tests. Web Performance Tests commonly target a single application, page or feature and contain manual (or recorded) steps in a way that they can be turned into repeatable tests. Visual Studio Load Tests can take those individual Web Performance Tests (among other things) and turn them into a real load or stress test. These two test types contain numerous configurable settings, so make sure you check your available options.

Within this project type you will find two main components: Web Performance Tests and Load Tests. Web Performance Tests commonly target a single application, page or feature and contain manual (or recorded) steps in a way that they can be turned into repeatable tests. Visual Studio Load Tests can take those individual Web Performance Tests (among other things) and turn them into a real load or stress test. These two test types contain numerous configurable settings, so make sure you check your available options.

The tests

You can use the included Web Test Recorder (integrated in Internet Explorer) to setup simple tests. But for my SharePoint projects, I usually start with a generic solution layout I created. This solution contains at least the following areas of interest:

Landing Page (Web Test)

Most of my SharePoint projects include some sort of customized Intranet landing page. And since most customers configure their browsers home page to point to the Intranet landing page, we need to make sure this first page performs adequately. In most cases I am looking for sub-second page processing, but of course this depends on customer requirements, design, architecture and hardware or components used.

Search (Web Test)

In Intranet solutions SharePoint Search usually plays a vital role. It is used to locate information, knowledge, people and documents. But especially with SharePoint 2013, search powers a lot of other functionality (Navigation, Content by Search, Product Catalogs). Again, usually looking for sub-second query handling and processing.

Custom Solutions (Web Test)

If you have any custom components included with your solution, either third party or your own, you can test them individually by isolating them on separate pages. This way issues are easily traced back to a specific component.

Interfaces (Unit Test)

Any interfaces required or used in your solution that can be tested using Unit Tests could be included in your tests. In my case, these are commonly WCF interfaces used by BCS. For more information how to quickly create Unit Tests based on WCF Service calls, head over to http://wcfloadtest.codeplex.com/ for more information. Beyond the scope of this article, which is meant to get you started with Load Testing your SharePoint solutions.

Load Test

Load test puts all the pieces together. Individual tests are about how a solution performs with a single user, whereas a load test simulates this with multiple users. Load tests can be run from single machines, but in order to create enough traffic Visual Studio allows you to setup Load Test Controller and Agent machines. See MSDN http://msdn.microsoft.com/en-us/library/vstudio/hh546459.aspx for more information.

The setup

You probably start with creating and developing your Load Test solution on a development machine. Once everything is in place (and tested), you setup your test rig to run the actual tests. Depending on your requirements you need one or more machines for this, see MSDN for more information. http://msdn.microsoft.com/en-us/library/ff937706(v=vs.120).aspx

Test data used

In order to be able to reuse our Visual Studio solution in future projects, we parameterize as much as possible. This way we only have to adjust the data source files updating hostnames and usernames/ passwords. Another important reason we use data sources for our application data (instead of static data), is that our virtual users can utilize these to simulate different requests. If all our test users would perform the same requests over and over again, this would not mimic real world scenarios!

Visual Studio Solution layout

Since there is a lot configuration involved, listing all of them would require quite a few steps. My advice: take a look at the attached sample download for detailed information, because I only highlight the essential steps here.

  1. Create a new Visual Studio Solution and Project using the “Web Performance and Load Test Project”. If you don’t see this option available under the “Test” category, you might have the wrong Visual Studio edition. See http://www.microsoft.com/visualstudio/eng/products/compare for more information.l2
  2. Get rid of the default WebTest1.webtest file. I’d like to create a special structure within my solution to organize things a bit.
  3. Create a couple of folders to hold and organize our tests:l4
    Load Tests Contains the different Load Tests.
    SP
    | Custom Solutions If I have custom web parts and stuff, I put each of those on a separate page and create a Web Tests for them.
    | Interfaces Any interfaces (usually Web Service end points used by BCS) used in your solution.
    | Landing Page Contains Web Tests targeting the internet/ intranets landing page(s).
    | Login Contains Web Tests targeting login pages (mainly for Form Based Authentication).
    | Recorded Contains any recorded tests using the Internet Explorer integrated Web Recorder.
    | Search Targets search, usually at least a generic search and a people search.
    Test Data Contains Test Data used in the different Load- and Web Tests.
  4. Create your first web test. In this case for the Landing Page. As mentioned earlier, you can create those using the Internet Explorer integrated Web Recorder but I’d like to add them using Visual Studio itself. Because we parameterize those using Data Sources, this configuration can be used for most projects.l5
  5. Add a Web Requestl6
  6. Add our data sources for Host Names and Users (see The Setup)l7
  7. Parameterize the Web Test and Request using our data sources. See the attached sample solution for more information.l8Once you have some (or all) of the individual tests ready, you can add and configure your load test.
  8. Add a Load Test project item. The “Create New Load Test” wizard will pop up and guide you.
    LoadTest LoadTestWizard

Run Settings

The result of the “Create New Load Test” is a configured load test, with a single scenario containing the selected Web Tests, Browser Mix and Network Mix. You can add additional scenarios and tweak any run settings from here.

The test run

From here it is up to you, so happy testing. I included a Visual Studio (2012) solution if you want to take a look at all the options. Remember, this in only for VS Ultimate!

You can download the Visual Studio solution here.

More posts to come 🙂

  • Code Review/ Code Analysis
  • Unit Tests
  • Coded UI Tests

/Y.

Advertisements

5 comments

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s