Skip to main content

Load Test using Windows Azure and Visual Studio 2013

In a perfect world I would except to be able to run a load test or a stress test using a cloud provider without being forced to change any line code from my tests. 
In this article we will find out how to do this thing using the new cloud service. How a person without knowledge of cloud will be able to run a load test with 50.000 users for 24 hours with minim costs, without being obliged to purchase and configure 10, 20 nodes.

What is a load test?
What is a load test in fact? An expression that I think it fits when we need to answer this question would be: ”Are you ready to be so popular?”.  The main scope of this kind of test is to define and validate the maximum load that a system can have without affecting the performance. Even though the developer tells that the system can handle without any problem 1000 users in the same time, the load test can prove the contrary even on simple scenarios.
There is a tiny difference between the load test and stress test. Many times the load test finishes with a stress test that has the purpose to observe the behavior of the system in the moment when the load increases above the maximum supported capacity.

What the market offers us now?
At this moment it is full of different solutions for automated testing and for running load tests. Products like Selenium, LoadStorm or Neoload dominate the market. Besides them there are many others and I don’t think 10 pages will be enough to enumerate them.
If we use an on-premise solution then we need to be prepared to resolve things like the acquisition and reservation of the resources for the load-test. In a small company it will be very hard to buy 10 servers just to run the load-test. A big company, even if it has the financial resources it will take a while until this resources will be available and sometimes it might be too late. Besides all this factors the configuration of each machine and deploy can be the labyrinth from which we won’t be able to find a way out.

What is the Microsoft proposal?

On this extremely mature market, Microsoft appeared with an ingenious solution. If they already have a powerful and robust infrastructure for cloud why don’t use it to run load tests using Azure. Even though they are not the first ones that are offering this kind of solution, Microsoft has an advantage. They allow you to run load tests using Azure without using a new configuration. All you have to do is to have an account on Visual Studio Team Foundation Service (http://tfs.visualstudio.com/) which will be used for the receipt.
 Before a load test using Microsoft could have been done only through Load Test Ring. This if formed from a controller that controls the tests- Load Test Controller and one or more agents on which our tests run. An architecture that is based on master-slave. The new version of Visual Studio 2013 provides us a new option- instead of running our test in our own Load Test Ring we can run them on Azure, without a new configuration. We don’t have to deploy any virtual machine or to configure different services.
 
Load Test Web Service
Load Test Web Service is the new Azure service that helps us. Through this service, Visual Studio 2013 loads our tests on the cloud. Behind this service is a pool of test agents that is used to run our tests. This thing happens behind the scene and we don’t have to do anything for this to run. All the results from our test together with other performance counters are available for us.

Which are the main characteristics?
Before looking over different functionalities that are supported I propose to first take a look at the most important options that are supported now.
We have the possibility to define UI tests and more. Beside the fact that we can record our UI tests we can also write our custom tests and hit different endpoints. The tested endpoint doesn’t have to be only HTTP or HTTPS. We can also test a WCF or REST endpoint and also a web service. The only condition is that the endpoint must be accessible via internet.
Visual Studio 2013 brings a project template- Web Performance and Load Test Project. This type of project will allow us to define and run load tests on cloud.


How to create a new load test?
The easiest way to create a load test for a web application is to create one or more Web Performance Tests. This type of test can be UI tests which are very easy to create and to automate. Using the UI recorder that comes with Visual Studio 2013 we can create a Web Performance Test in just a few seconds. This type of test can be modified at any time and if we want we can generate code for the test. Through this method the ones that wish to write code to modify the code can do this very easily. Of course that functionality like automatically detection of the dynamic elements that the page has or to extract different constants as parameters is supported out of the box.
For each test of this type we can generate different sources like database, CSV or XML file. You can also use the tests written in Selenium for example. Each test can call other test and this way we can reuse the logic that we already have for testing.
Until now we saw how we can create a test can be used for the load test. It is time for us to see what a load test allows us to do.

Which are the main functionalities?
The first thing we need to do in order to create a load test is to THINK. We can define different profiles and time intervals through which we should be able to simulate a real user. For example we can simulate a delay of X seconds after each test. We have available different profiles which we can use.
The way we simulate a load test can be made through different methods. We have the possibility to run a test with a specific number of users or we can define the number of users to increase at every step. Of course that most of the times we will have to run different scenarios in the same time. That why we can select the tests that we want to run and in what proportion, but also the way that this test have to run. For example we can specify how many times a test should run in a time interval or which is the number of users that have to run a specific test in every moment while the load test is running.
We can simulate different browsers that the clients might have and different types of connections. The most interesting thing is that we have the possibility to add and access not just performance counters from the clients but also the ones from the servers on which our application is running. This way we can monitor and see the counters from both the client and the servers.

How to run a load test in cloud?

Until now we saw the main options that we have available to run a load test, but we didn’t saw how to run this type of test. All we have to do to run the load test on cloud is to open the Local.testsettings and on General tab to select “Run tests using Visual Studio Team Foundation Service”. This is the only thing we have to do to run the test on cloud. Of course that we have to be logged uni in Visual Studio with an account that is connected tp Visual Studio Team Foundation Service.

What is the price?
For this moment the service is on preview. Each user has 2000 virtual minutes per month that can use for the load tests. There aren’t fixed prices for this. If you need more minutes for load tests all you have to do is to enter in the early adoption program without additional costs. You will have 200.000 virtual minutes per month that you can use. Accepting the request takes very little time (in my case around 6 hours).
The first time I heard about virtual minutes I wondered what these are. A virtual minute is the duration of the load test multiplied with the number of users.
Once we run the tests we will have access to all the results including performance counters, failed tests, error messages and different diagrams. All the results can be exported into an Excel that will automatically contain the diagrams that you can show it to the clients.

I invite you to try the new cloud service for load tests. I was pleasantly surprised by this service and I think it will make our life easier.

Comments

Popular posts from this blog

How to check in AngularJS if a service was register or not

There are cases when you need to check in a service or a controller was register in AngularJS.
For example a valid use case is when you have the same implementation running on multiple application. In this case, you may want to intercept the HTTP provider and add a custom step there. This step don’t needs to run on all the application, only in the one where the service exist and register.
A solution for this case would be to have a flag in the configuration that specify this. In the core you would have an IF that would check the value of this flag.
Another solution is to check if a specific service was register in AngularJS or not. If the service was register that you would execute your own logic.
To check if a service was register or not in AngularJS container you need to call the ‘has’ method of ‘inhector’. It will return TRUE if the service was register.
if ($injector.has('httpInterceptorService')) { $httpProvider.interceptors.push('httpInterceptorService&#…

ADO.NET provider with invariant name 'System.Data.SqlClient' could not be loaded

Today blog post will be started with the following error when running DB tests on the CI machine:
threw exception: System.InvalidOperationException: The Entity Framework provider type 'System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer' registered in the application config file for the ADO.NET provider with invariant name 'System.Data.SqlClient' could not be loaded. Make sure that the assembly-qualified name is used and that the assembly is available to the running application. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information. at System.Data.Entity.Infrastructure.DependencyResolution.ProviderServicesFactory.GetInstance(String providerTypeName, String providerInvariantName) This error happened only on the Continuous Integration machine. On the devs machines, everything has fine. The classic problem – on my machine it’s working. The CI has the following configuration:

TeamCity.NET 4.51EF 6.0.2VS2013
It seems that there …

Run native .NET application in Docker (.NET Framework 4.6.2)

Scope
The main scope of this post is to see how we can run a legacy application written in .NET Framework in Docker.

Context
First of all, let’s define what is a legacy application in our context. By a legacy application we understand an application that runs .NET Framework 3.5 or higher in a production environment where we don’t have any more the people or documentation that would help us to understand what is happening behind the scene.
In this scenarios, you might want to migrate the current solution from a standard environment to Docker. There are many advantages for such a migration, like:

Continuous DeploymentTestingIsolationSecurity at container levelVersioning ControlEnvironment Standardization
Until now, we didn’t had the possibility to run a .NET application in Docker. With .NET Core, there was support for .NET Core in Docker, but migration from a full .NET framework to .NET Core can be costly and even impossible. Not only because of lack of features, but also because once you…