Whenever we develop a web site or web application, it is mandatory that we should do load testing before production. It will give us an idea about how many users and requests it can handle per second in a given server environment. In theory its easy to say we should do the load testing. But in practice, very less people knows, how it is being worked out and what are the software tools used to do load testing.
One of the load testing tool is Visual Studio itself ! But before going into load testing in Visual studio, let us see what a load testing software in general should provide and how a load testing is carried out.
Features of load testing software
- Recording
- Ability to record the different use cases of the application. Mainly uses script for storing purpose.
- Ability to add parameters / tokens into the recorded use cases / script for handling virtual users and passing other runtime values.
- Play back
- Ability to run the recorded use cases / scripts by replacing the tokens with run time values
- Ability to run simultaneously from multiple machines or agents.
- Controller agent model to collect data from the nodes which are executing the scripts.
- Ability to create virtual users in the controller agent environment.
Steps to do load testing
- Record the use cases in a format which can be playable
- Adding parameters (optional)
- Add tokens or place holders to the recorded script so that it can be replaced by actual values at run time
- Write the token / parameter replacement logic.
- Define web load test cases. eg: 25 virtual users
- Setup the agents.
- Run the recorded load test cases and collect the results.
Web performance load testing using Visual Studio
This feature is available in high end versions (Ultimate) of Visual Studio. If your Visual Studio supports load testing, you can see the webtest template and load test template. If your application is a web site its very easy to record the scripts. This is because the Visual Studio has an in built mechanism to record the http(s) traffic from internet explorer. If your internet explorer is in record mode, you can easily perform use cases and record the action. But if you are developing a windows application which uses http(s), it is little difficult to record because Visual Studio cannot intercept your windows desktop application to capture the http(s) traffic. So what to do? In fact that is the aim of this post.
Recording visual studio web test in desktop world
There is a really really useful tool called fiddler. It must be familiar to the web developers but not for windows developers. This tool can act as proxy which sits between any application and the network to capture all the http(s) requests and responses. Now a days most of its duties can be done by the F12 browser tools. But in the desktop environment, fiddler still has importance. Below is the sequence to create web test of windows applications using fiddler.
- Run Fiddler
- Setup support for https if required
- Run the application
- Execute a use case
- Goto fiddler and select File -> Export Sessions -> All Sessions
- Select Visual Studio WebTest
- Add the exported web test to Visual Studio project.
- Add tokens / parameters to the web test.
- Clear the fiddler session
- Repeat the steps 3-8 for all the use cases in your application which you want to load test.
No comments:
Post a Comment