Click here to Skip to main content
Click here to Skip to main content

Load Test Using Visual Studio 2010

By , 30 Oct 2012
Rate this:
Please Sign up or sign in to vote.

I have been writing code from last 7 years and I am sure many of us have went through the below situation. We always test our code thouroughly, and will send it for testing expecting zero bugs. When a tester raises an issue with anything, the first thing that comes to our mind is . .

After all the struggle we will make it to Production, and the smoke test goes awesome. When the users start using the application . . .  "BOOM".

                                     Performance Issues . . .

Most of us will have only one answer . . .

This is where we need to consider, certain factors. We do unit testing using Manual testing, N Unit testing, ect. But, we need to perform a load test before stamping something as 100% tested (or) before moving it to production.

We cannot always depend on Loadtest performed by the testing team. So, its our responsibility that the code will work even under the expected load. So, we will see how we can perform a Load Test Using Visual studio 2010 Ultimate.

Step 1: Identify or Create a web application, for which you want to perform a Load test. Here I have created a simple web application, with Login and Logout controls.


 
Step 2: I created a Test project with name LoadTestProject. Now in the first place i will add a Test file to this project. When you click "Add New", VS will present you with lot of options. Here we need to select a "Web Performance Test" for this scenario. I named it as "SingleUserPerfTest".

Step 3: Once you click Add, you will be presented with a explorer window with recording infrastructure. All you need to do is, click the "Start Record" button and perform what are all actions/browse through pages you want to test.

Step 4: Once you are done with all the stuff, click on Stop button. Visual studio will convert all the recorded steps into code, embedded into .webtest file.

You can expand the nodes and see what are all the actions recorded, and what are the requests/responses generated while our webtest.

You can run this test by clicking the Left-Top button, but this will be equal to our unit test. We haven't tested the response of application under load.

Step 5: Now Add new test file to project. This time select a Load Test file from the menu. I named it as "SampleLoadTest".

Once you click Add button, you will be presented with a wizard, using which you will configure the Load test.

Step 6: As a first step, we will name the scenario, and will setup think time for the profiles.  In the real time scenario, the users will take 1 to 3 seconds between performing one action after another, either due to reading webpage or thinking. This delay will be created while load test using "Think Time" specified below.

Step 7: In next step you will be selecting the load pattern. Whether you want to apply a constant load or increase the load in a cumulative way. These variables can be configured here.

Step 8: Now, you have to select the Individual webtest(s) you have created earlier, which need to be considered under this load test.

 Step 9: Here you can select either for how much time you want to run the test, or how many iterations of test you want to perform.

Step 10: Once you click "Finish" button, all the configuration will be embedded in to the Load test file. You can click on each specific step/ configuration, and can modify the values in property window.

Step 11: We are all set now. Click the "Run Test" button on Top-Left corner and see what happens.

All the key factors will be presented graphically while performing the load test. We can figure-out different factors and their variation patterns under load conditions.

Finally after completion of test, a test result document will be created using which you can analyze what are the stress factors where we need the performance tuning.

These test results can also be stored into database by configuring the controller connection string.

Download Sample Code: Sample Load Test Project

Is it helpful for you? Kindly let me know your comments / Questions.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

PratapReddyP
Web Developer
India India
I am an Aspiring Architect, having expertise in Design and Development. Good knowledge on TDD and DDD Approaches. Well versed with Agile methodology. Strong at Sharepoint, C# , Asp.Net, MVC, MVC Razor, WCF, Entity Framework, SQL, BI Tools.

Comments and Discussions

 
QuestionHow to handle popups PinmemberMember 1067574916-Mar-14 22:40 
SuggestionImage link issue PinmemberSandip.Nascar30-Oct-12 6:09 
GeneralRe: Image link issue PinmemberPratapReddyP30-Oct-12 14:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web01 | 2.8.140415.2 | Last Updated 30 Oct 2012
Article Copyright 2012 by PratapReddyP
Everything else Copyright © CodeProject, 1999-2014
Terms of Use
Layout: fixed | fluid