Test your applications with maximum load to avoid any unexpected behaviors.
In this article, I will give you the basic configuration steps which we need to perform a load test in cloud using Visual Studio 2013 Ultimate.
Performance is the primary focus of the developers building web applications. And testing the application with maximum user load was always a challenge for the developers. The development server may not have the capacity of production servers. With the introduction of load test in cloud environment, the application load testing becomes very easy.
Configuring Load Test in Cloud
Setup Visual Studio Online Account
We can configure the load test with the help of Visual Studio Online or Team Foundation Server. Here we will configure the cloud based load testing using visual studio online account.
First we need to create a visual studio online account.
- Login to www.visualstudio.com with your Microsoft account.
- Next step is to create an account.
- After successful creation of the new account, just browse that account (For example: https://yourapp.visualstudio.com) and you will see the below page.
- Click on ‘New’ in recent projects & teams as shown in below figure to create a new team project to which we are adding the load test project.
Thus we finished creating/ set up Visual Studio online account needed for executing our first load test.
Create a Web Performance Test Project
Before creating any load test project, first we need to create a web performance project to which we are recording/configuring our test steps.
In load test, we are applying load to the web test.
- Create a Web Performance and Load Test Project. By default it will create a file ‘
WebTest1.webtest’, on which we are recording load test steps.
- Click on ‘Add Recording’ to record the web test. The web browser will be opened.
- Make sure the test recorder plugin is enabled in the browser and record the actions in the site. I am not digging in to the details of the test recording.
- After recording the necessary steps you wanted to test, just stop the record in the browser and steps will be added to the performance test file (
WebTest1.webtest) as shown below.
- Now just run the test and we will get the result of the web performance test.
- Here, we can configure many things like data source, context parameters, dynamic parameters, etc. I just explained the steps for the very basic web test.
Thus, we successfully created the web test on which we need to test the load.
Adding Load Test to Web Performance Project
- Add the load test file to the existing solution where we added the
- Now click on create new project and select ‘Load Test’. And we can configure the test settings.
Load Pattern: Here we can configure ‘Step load’. We are setting the initial user count as 10 and maximum user count as 200. In each 10 seconds, 10 more users will be accessed the system. We can configure step load according to our need.
Test Mix Model: It will help us to configure different work flows for our test. I am keeping the default one. To get the more details of the Test Mix Model, you can refer the following URL.
Test Mix: We can distribute the load with a different web performance test. In this demo test, I am selecting the ‘
WebTest1.webtest’, the web performance test we created before.
To get more details, check the URL:
Network Mix: We can mix different network types for load test.
For more details, refer to the URL:
Browser Mix: This is for configuring different browser types. For more details, check the below URL:
Run Settings: For this demo test, I am keeping the load test duration as 5 minutes. You can define the duration according to your need.
- Upon clicking finish, the load test file (
LoadTest1.loadtest) will be added to our project as shown below.
- Next, we need to configure the location in which we are going to run the test. You can find a file ‘
Local.testsettings’ under solution items in solutions explorer.
Select the check box ‘Run tests using Visual Studio Online’. So here, we are defining our test is going to execute in cloud environment.
- Next is to configure the Visual Studio online account URL to the project (The URL we created initially, https://yourapp.visualstudio.com).
For this, select the team explorer -> Select Team Project as shown in the below figure.
- Click on ‘Select Team Projects’ in Team Explorer (as shown below).
- Click on ‘Servers’ in ‘Connect to Team Foundation Server’ popup window. And Click on ‘Add’ in ‘Add/Remove Team Foundation Server’ popup windows.
- Give Visual Studio account URL or TFS account (if you have) in ‘Add Team Foundation Server’ popup and click OK.
- After clicking ‘OK, it may ask for Microsoft account, give your credentials.
- After adding the Visual Studio online URL, we can see the team project we created initially in the Visual Studio online portal (
LoadTestInCloud). So select that team project as shown below and click on connect.
- Now we are ready to run our first load test. Click on ‘Run Load Test’ in
- The load test started……………………………..
- But the first load test we created failed ……………………….. Anyway, let us see what went wrong.
There is some exception related to the request ‘https://login.live.com/login.srf...’ To analyse the exception, we should download the report. So click on ‘Download report’. But again an error…….. But don’t worry; errors are always giving some new information.
So first, we should see what went wrong while downloading the error report to see the actual issue that cause the load test failure.
From the above error message, it’s pretty clear that there are some issues with the connection to SQL server. By default, the errors are importing to a database. So we should configure the database initially. To create the database, we need to execute an SQL (loadtestresultsrepository.sql) which is available inside the Microsoft Visual Studio folder.
In my case, it is inside D:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE. (I am using Visual Studio 2013 Ultimate).
Execute the following command to create the database:
D:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE>SQLCMD /S SQLInstance /i loadtestresultsrepository.sql
You may need to include your database credentials in this command. So the database created successfully. If you check your SQL Server, you can see a database created with the name ‘
Also we should configure the database to our Load test we created. Right click on
LoadTest1 (as shown below) and click on Manage Test Controllers. You will get the prompt to configure the database.
So the database configuration part completed successfully. Next click on ‘Download Report’ in the test results page. It will get imported to the database we created. Then click on View Report to see the error details.
So we got clear that the original error thrown is Context parameter ‘
QueryStringParam49.ct’ not found in test context. So to analyse more, we should check the original web test we created (
In the web test, we can see ‘
QueryStringParam49.ct’ under https://login.live.com/login.srf. The load test was expecting a parameter which we didn’t supply. In our real time applications, we should handle the dynamic parameters. The dynamic parameters can be load from database, csv file, etc. In our case, we can remove this line to move forward. So deleted the line ‘https: //login.live.com/login.srf’ as it is not necessary to go on with the demo load test.
Next we can run load test again. After initial configurations, if you need to change the user load, step duration, etc. you can do by right clicking ‘Step Load Pattern’ (This may vary according to your initial setup) and click on properties as shown below. Here I am changing the Maximum User Count as 40. It was initially configured to 200.
LoadTest1 again and let us see the results. This test will consume 250 virtual user-minute.
The test completed successfully without any error and we can start analysing the application performance.
We can see the graphical representation of the load test results. The performance of the application and throughput is very much clear from the below graphs.
I tried to explain the very basic configuration steps needed to configure the load test in cloud using Visual Studio 2013 ultimate. We can use either Visual Studio online or team foundation server to configure the load test.
- 30th April, 2015: Initial post