Web Performance Test

 

So I decided I wanted to learn more about the testing capabilities of VS2010 – esp. load testing a web service.  I fired up Visual Studio and created an out of the box WCF Service with the following 1 method:

public class AddingMachine : IAddingMachine
{
    public int GetData(int value1, int value2)
    {
        Random random = new Random();
        Int32 delay = random.Next(15);
        Thread.Sleep(TimeSpan.FromSeconds(delay));

        return value1 + value2;
    }
}

I then added a new test project using a Web Performance Test template:

image

I then hit record, closed IE which automatically popped up, and navigated to the service using the WCF Test Client. 

image

I am sure you are not surprised that nothing was recorded.  The problem is that the out of the box Web Performance Test assumes that you are calling a web site so I couldn’t just hit a recording and navigate to a webservice the same way I would navigate to a website.

Instead, I had to right click and add a new web service request.  I then changed the Url property to the service location and tried to run the test.

image

I then binged on Google and ran across a couple of Stack Overflow posts and this nugget on MSDN.  Apparently, I need to use Fiddler to capture the request.  I fired up Fiddler and WCF Test Client (remember the “.” after local host) and sure enough and can make the call and intercept the traffic:

image

I copied the entire request from Fiddler:

image

But I got this when I ran the test I got the same exception.  The problem is that the article assumes an .asmx web service and I am using WCF.  Digging into the article’s code sample, I realized that I needed a Header like so:

image

and I needed to put only the body from Fiddler into the String Body property

Fiddler:

image

WebTest:

image

And green is good

image

Advertisements

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

%d bloggers like this: