a developer's notes – a semi-technical web development BLOG

November 19, 2013

Visual Studio Performance Load Test – Only First test passes, Subsequent Tests Fails

A big “gotcha” when doing load testing is cached data and stale browser cookies. When examining a load test result, you can spot this symptom when you notice only the 1st (or first few) web tests passes before the test starts to encounter a bunch of failures. Cross check this by making sure your web test can execute many iterations without failure. So if you verified that the web test works with many (if not all) with your data inputs but the load test is producing strange errors, check the following:

1. Percentage of New Users

In your load test file, highlight the Scenario that contains your web test and view its properties. You should find the Percentage of New Users

scenarioProperties

property and set that value to 100. That will ensure all iterations in your web test will be new users.

2. Clear the Cookie Container

Create a WebTestPlugin and on the PreWebTest method, you can clear the container with the following snippet:

public override void PreWebTest(object sender, PreWebTestEventArgs e)
{
     e.WebTest.Context.CookieContainer = new System.Net.CookieContainer();
}

Add this plug-in to ensure at the beginning of each web test, there are no stale cookies from the last virtual user that executed a web test.

Advertisements

1 Comment »

  1. Thank you very much. You saved my life 🙂

    Comment by Ertugrul ALTINOK — April 8, 2016 @ 9:18 am | Reply


RSS feed for comments on this post. TrackBack URI

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

Blog at WordPress.com.

%d bloggers like this: