Stress test your website

Name: *
My email: *
Recipient email: *
Message: *
Fields marked as bold are compulsory.
You haven't filled in compulsory values. The email is not correct

Publishing a website is always a pleasant thing to do. However there may be times you guess your website works fine but things will go bad later on. That may be the time the website starts gathering a lot of visitors, much more than the few users that have been testing it before deployment. At that point a few requests on the database or less optimized source code might not look that bad but when a few hundred visitors or more roam around your website at the same time, things may start looking gloomy.
 
That may be either the result of poor server hardware or slow connection between the server and the database or lousy source code or, well, pretty much anything. Things tend to go bad under pressure. To avoid unpleasant surprises a developer may create stress tests using Visual Studio so he can foresee what may happen in future and fortify the website as soon as possible. 
 

Getting started

 
So, what is a stress test? A stress test simulates a bunch of users moving around our website, the way average visitors would, and marking down its reaction to them. 
 
To begin with, we are taking a walk around the website and record its track. Then we create the test using the options we like, for example how many users will be simulated, how long the test will last, the browser type the visitors are using etc. After we are all set, we run the test and watch the reports created before us describing the website's behaviour.
 
Seems quite simple. Now let's check it out, step by step, and create a stress test of our own. Keep in mind that this article is nothing more than an introduction to stress tests. Readers who wish to become stress test professionals will find much more info around the web.
 

Creating a web test

 
We are going to create a stress test using Visual Studio 2013 Ultimate.
Go to Files -> New Project and choose Web Performance and Load Test Project having selected Visual C# -> Test on the templates column.
 
Right click the project we just created and select Add -> Web Performance Test.
 
This will automatically open our Internet Explorer and the Web Test Recorder on its left column. All you have to do now is go to your website and do what you think the average visitor would do. If, for example, you think that creating an account is quite a common thing to happen by lots of people simultaneously, go for it. If not, you'd better avoid it. You can see the path you have created on the Web Test Recorder.
 
load test duration                                        
 
When you feel like it, push the stop button to terminate the recording process. This will create a WebTest file on your project.
 

Creating a load test

 
So far we have created a web test, where we have recorded what we want to test. To test it we will have to create a load test.
 
Right click the project and select Add -> Load Test. A wizard will appear which will guide you through the process. You may select the preferences you wish. 
load test wizard
 
For example, you can set the load pattern, how many users will visit your website, if they will take step load actions and what options these steps will have.
load test pattern
 
You may also add more than one web test to the load test.
load test more
 
There are a lot of options including warm up and actual test duration.
load test duration
 
 

Running the test

 
You can run the load test using your own machines but using cloud-based load testing would be easier. You will however need to have a Visual Studio online account which is really no big deal. All you have to do is visit this location
and create your account for free. Then use your account info on the visual studio and you are ready to go.
 
load test duration
 
To run the test, select the load test you like and press the test icon on the top left side of the screen. It will take a few moments for visual studio to set up its resources and the test to begin. Once it starts, you can see the way your website responds right on your screen.
 
load test duration                                        load test duration
 
load test duration                                        load test duration
 
When it's all over you can get some nice reports and graphs.
 
load test duration
 
 

Summary

 
To test a website under pressure, we create stress tests. That way we can simulate how the website will respond when a lot of users come around at the same time. First we mark down the typical user behaviour and then we set the test parameters. When we are ready, we run the test and watch the results created on run time. We can avoid unnecessary trouble by using cloud-based testing through visual studio account.  
 

Back to BlogPreviousNext

Comments



    Leave a comment
    Name: