What is Load Testing in Software Testing
In many cases, the load tests are carried out in order to determine the maximum number of users that can be served on the selected server. Accordingly, the stress tests carried out before the launch of the product launch. But this approach does not give you an answer to the question: Is it possible serve more users? Perhaps you need a little bit to optimize the code, and the server can properly serve the increasing number of requests.
Of course, it is possible to launch a project to dig into the code to find weaknesses, try to improve them, but still it's not the most effective way to optimization, as there are no adequate metrics. How do you know what improvements do you have to make? It suffices to say: this application will not work ever better. What is "better"? Where is the standard? How far we are from it? What is load testing in software testing?
By asking these questions, we will gradually move into the second approach of the load tests. Load tests should be performed regularly during working on the project (for example, at the end of the sprint). And you should start from the moment when you have the skeleton. The result of the load test on the benchmark server where you put your application skeleton is the standard.
Further measurements will show you the changes with respect to the benchmark. And if the changes are dramatic, it is an occasion to carry out further work to optimize the code. Simply look for performance problems at an early stage, rather than trying to shovel the whole project in the end.
Equipment for Load Testing in Software Testing
There is another problem of the load tests. It is equipment (the server), which will generate the load. The problem is that for adequate load tests next to the benchmark server, you need to put the same or better server for load generation.
Moreover, you run the risk of inadequate results in the case, if your server is fighting sticks out on port 80, and you are testing it using a local area network of the organization, which is generating your server load.
Try to justify the purchase of procurement services server that you are going to use every 2 weeks for one to two hours. Very often, in this case, obsolete servers are used or some apps are switched off during the testing time in order to use the resources freed up under the load tests (such a scenario is very rare, but such cases sometimes happen).
Both options have their drawbacks. For example, the server that is not used can be just turned off to save power, etc. A process of interruption of the application within the organization can create a real hell for everyone.
Generally, you probably understand what we mean. It is necessary to use cloud resources with hourly payments. On the server, you need to fill and set up the necessary software for the generation of load (sometimes this is not a trivial task).
Load Testing with Visual Studio Team Services
We suggest using Visual Studio Team Services (formerly Visual Studio Online) to generate the load. So, what we need:
Visual Studio Team Services account
Visual Studio Enterprise
Let's get started:
Once you have created a free account in Visual Studio Team Services, you need to create a new project with the name and the version of control system that you use (for this demo does not matter what to choose):
After that, we need to link your new account to the Visual Studio. To do this in Team Explorer in Visual Studio, we need to enter the parameters to our project:
You also need to add a new user to the list of Visual Studio account and enter the password:
Now take the following steps one by one:
After connecting to the window «Connect to Team Foundation Server» a list of projects is displayed. We have only one item, so we choose it;
Next, create a new project in Visual Studio. In the «Test» section choose «Web performance and Load Test Project», enter the new name the project;
After pressing the "OK" button, we will test a new web project. Actually, now our task is to write down the web test. To do this, click the button «Add recording» into our web test;
Open a Web browser. All that you will do will be recorded.
We go back to Visual Studio and click Stop recording;
If after pressing the «Stop recording» nothing has changed (there's no url with a set of attributes in the Web test ), you should include a Web browser add-on in the «Microsoft Web Test Recorder Helper»;
After all the web test is recorded, it is now necessary to start it with a desired number of virtual users. So we add Load Test to our Visual Studio project. Click the project of our web test in Solution Explorer -> Add -> Load Test;
We've opened the wizard, which you need to go through. In the first step, select «Cloud-based Load Test with Visual Studio Team Services»;
Then select the data center location from where the load will be generated;
Next, set the duration of the test;
Then we reach the «Load Pattern». Select «Step Load». The point here is that there is a stable load. This means that the load will generate a predetermined number of users throughout the test;
We choose a more interesting scenario where the number of concurrent users will gradually increase in a predetermined pattern;
As you guessed, we've loaded thousands of concurrent users;
Further, we add our web test to the Test Mix;
After that, we can configure the browsers, and then click Finish. Run the load test;
It will take some time, and we'll start to see graphs of the response time on the number of concurrent users:
At the end of the test you can load a detailed report into Visual Studio and see what's happened. Here's the example statistics for test errors:
Detailed reports can be uploaded into Excel and analyzed there. And if you have a previous checkup, the Visual Studio can analyze how the performance has changed from the last time.