Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / DevOps / load-testing

Load Test in Cloud using Visual Studio 2013 Ultimate

4.66/5 (12 votes)
30 Apr 2015CPOL7 min read 37.2K   4  
Load test in Cloud using Visual Studio 2013 Ultimate

Image 1

Test your applications with maximum load to avoid any unexpected behaviors.

Introduction

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.

Background

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.

    Image 2

  • Next step is to create an account.

    Image 3

    Image 4

    Image 5

  • After successful creation of the new account, just browse that account (For example: https://yourapp.visualstudio.com) and you will see the below page.

    Image 6

  • 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.

    Image 7

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.

    Image 8

  • Click on ‘Add Recording’ to record the web test. The web browser will be opened.

    Image 9

  • 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.

    Image 10

    Image 11

  • 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.

    Image 12

  • 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.

      Image 13

      Image 14

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 webtest1.webtest.

    Image 15

  • 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.

    Image 16

    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.

    https://msdn.microsoft.com/en-us/library/dd997826.aspx

    Image 17

    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:

    https://msdn.microsoft.com/en-us/library/ms243157(v=vs.100).aspx

    Image 18

    Image 19

    Network Mix: We can mix different network types for load test.

    For more details, refer to the URL:

    https://msdn.microsoft.com/en-us/library/dd997557(v=vs.100).aspx

    Image 20

    Browser Mix: This is for configuring different browser types. For more details, check the below URL:

    https://msdn.microsoft.com/en-us/library/dd997561(v=vs.100).aspx

    Image 21

    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.

    Image 22

  • Upon clicking finish, the load test file (LoadTest1.loadtest) will be added to our project as shown below.

    Image 23

  • 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.

    Image 24

  • 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).

      Image 25

  • Click on ‘Servers’ in ‘Connect to Team Foundation Server’ popup window. And Click on ‘Add’ in ‘Add/Remove Team Foundation Server’ popup windows.

    Image 26

  • Give Visual Studio account URL or TFS account (if you have) in ‘Add Team Foundation Server’ popup and click OK.

    Image 27

  • After clicking ‘OK, it may ask for Microsoft account, give your credentials.

    Image 28

    Image 29

  • 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.

    Image 30

  • Now we are ready to run our first load test. Click on ‘Run Load Test’ in LoadTest1.loadtest file.

    Image 31

  • The load test started…………………………….. 

    Image 32

  • But the first load test we created failed ……………………….. Anyway, let us see what went wrong.

    Image 33

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.

Image 34

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

Image 35

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 ‘LoadTest2010’.

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.

Image 36

Image 37

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.

Image 38

Image 39

Image 40

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 (webtest1.webtest).

Image 41

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.

Image 42

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.

Image 43

Run the LoadTest1 again and let us see the results. This test will consume 250 virtual user-minute.

Image 44

The test completed successfully without any error and we can start analysing the application performance.

Image 45

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.

Image 46

Image 47

Summary

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.

History

  • 30th April, 2015: Initial post

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)