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.
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.
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".
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.
Once you are done with all the stuff, click on Stop button. Visual studio will convert all the recorded steps into code, embedded into
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.
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.
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.
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.
Now, you have to select the Individual webtest(s) you have created earlier, which need to be considered under this load test.
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.
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.
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
These test results can also be stored into database by configuring the controller
Download Sample Code:
Sample Load Test Project
Is it helpful for you? Kindly let me know your comments / Questions.