Load Testing with Visual Studio


(function(i,s,o,g,r,a,m){i[‘GoogleAnalyticsObject’]=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,’script’,’//www.google-analytics.com/analytics.js’,’ga’);

ga(‘create’, ‘UA-54000341-1’, ‘auto’);
ga(‘send’, ‘pageview’);

Please click the link to download word format E-Book having images Load Testing user guide Chapter 1: Introduction. 2 Load testing introduction. 2 Difference Between load and performance test. 3 Performance testing:. 3 Load Testing:. 3 Process of Creating load Test in Visual Studio. 3 Guidelines for a Good load test. 4 Resources required for load testing With VSTS. 4 Chapter 2: Creating Web Application Performance Test. 4 Creating a Load Test Project. 5 Creating a Performance Test Using Recorder. 6 Parameterize recorded script. 8 Chapter 3: Load Testing Soap Web service. 11 Creating a Load Test Project. 11 Creating a Performance Test Using Recorder. 12 Parameterize script. 14 Chapter 3: Creating Load test against Performance test. 16 Add load test. 16 Executing load test. 16 Generating Report. 17

Chapter 1: Introduction

Load testing introduction

Load testing is the process of putting demand on a system or device and measuring its response. Load testing is performed to determine a system’s behavior under both normal and anticipated peak load conditions. It helps to identify the maximum operating capacity of an application as well as any bottlenecks and determine which element is causing degradation. When the load placed on the system is raised beyond normal usage patterns, in order to test the system’s response at unusually high or peak loads, it is known as stress testing. The load is usually so great that error conditions are the expected result, although no clear boundary exists when an activity ceases to be a load test and becomes a stress test.

Difference Between load and performance test

Performance testing:

“In the computer industry, software performance testing is used to determine the speed or effectiveness of a computer, network, software program or device. This process can involve quantitative tests done in a lab, such as measuring the response time or the number of MIPS (millions of instructions per second) at which a system functions. Qualitative attributes such as reliability, scalability and interoperability may also be evaluated. Performance testing is often done in conjunction with stress testing.”

Load Testing:

Load testing is meant to test the system by constantly and steadily increasing the load on the system till the time it reaches the threshold limit. It is the simplest form of testing which employs the use of automation tools such as Visual Studio or any other good tools, which are available. Load testing is also famous by the names like.   Difference:

Load Testing Performance Testing
Load testing is meant to test the system by constantly and steadily increasing the load on the system till the time it reaches the threshold limit Performance testing is measuring quality characteristics of an application like ‘Response Time’ , ‘Processor utilization‘ etc
It Is used to determine what’s the peak limit of request under which our application can work fine Performance testing is used to determine performance characteristics e.g. what’s the response of a certain functionality.
The goals of load testing are to expose the defects in application related to buffer overflow, memory leaks and mismanagement of memory The primary goal of performance testing includes establishing the benchmark behavior of the system. There are a number of industry-defined benchmarks, which should be met during performance testing.

      How it’s used: Normally Performance Test and Load test are performed together because when u generate a high volume load on the other hand u have to measure response time processor utilization and other quality characteristics

Process of Creating load Test in Visual Studio

These Diagram will explain a basic load test creation in visual studio.

Guidelines for a Good load test.

Load test should simulate crateristics of a real user as close as possible e.g. on sign in what can user do he can provide valid or invalid both type of credentials. Load Test must be provided a meaning full data. Test Data must be created after analyzing the process and all possible type of data that can be used in a certain functionality must be incorporated so that different types of behaviors can be simulated

Resources required for load testing With VSTS.

Resources required for a load test with visual studio are Software Requirements: Visual Studio Ultimate SQL Server Microsoft Excel   Hardware Requirements: It depends on load test

Chapter 2: Creating Web Application Performance Test

In this chapter we will explain how to create a Load test for a Web Application. As we know a web application works on HTTP requests, basically load test is done against these HTTP requests it doesn’t click any GUI elements or types in field e.g when you register on application it calls some GET POST method recorder records this GET POST method instead of recording in which elements user typed or he clicked.

Creating a Load Test Project

First step of creating a load test Project. To-do so perform following steps Steps:

  1. Open Visual Studio Instance
  2. Create a New Project By clicking New > Project….
  3. Click “Test” and then select “Web Performance and Load Test Project” with C#, Provide any Suitable name and click “OK”.
  4. After Creating Project

Creating a Performance Test Using Recorder

Second Step is to create a performance test it can be created using a recorder or directly calling HTTP requests here we will record HTTP requests using recorder. Steps:

  1. To Add a Performance Test Left Click your project and open Add > Web Performance Test.

Note: A Web Test will be automatically added and you can also rename that if desired

  1. Now to Start Recorder Click Record icon On Visual Studio It will start recorder in IE.

 

  1. Perform you Steps and recorder will automatically record HTTP Request

Here I am Performing Open login.live.com/ Provide Id and Password (Note: here I am using dummy credentials) Click Sign in U will see some HTTP requests recorded on left side of screen After Recording Click STOP.

  1. Wait for some time Visual Studio will be detecting some dynamic parameters automatically e.g Session ID

Generated Script will look like the below screen shot

Parameterize recorded script

As we know in load Test will simulate multiple Users therefore in some cases all user need a unique data set therefore it’s very important to Parameterize load. To this following steps are required to be done

  1. Identify Fields / Parameters e.g. in sign in two parameters must be dynamic ID and Password.
  2. Expand Your Request which is having parameters.

As you can see Password and ID, These two Parameters are needed to be dynamic

  1. We require a data source to bind our parameter with a data in Excel or SQL Server Table. To do this Create a data source by click highlighted Icon.
  2. If you want to fetch data for parameters from a CSV file select CS else select Data base.

In case of SQL Server create a connection with D.B by performing required steps and at last selecting table.

  1. After adding data source view will be like this.

 

  1. Left Click Parameter and expand list and then select field of table  in data source here I am selecting from CSV

Expand data source Expand  Table/CSV   Select Field Now parameter value will look like this

  1. Save you r test

Chapter 3: Load Testing Soap Web service

In this chapter we will explain how to create a Load test for a Web Service. As we know a Android, Web and different type of application are built on SOAP Web services   , basically load test is done against these SOAP Web services  requests.

Creating a Load Test Project

First step of creating a load test Project. To-do so perform following steps Steps:

  1. Open Visual Studio Instance
  2. Create a New Project By clicking New > Project….
  3. Click “Test” and then select “Web Performance and Load Test Project” with C#, Provide any Suitable name and click “OK”.
  4. After Creating Project

Creating a Performance Test Using Recorder

Second Step is to create a performance test it can be created using a recorder or directly calling HTTP requests here we will record HTTP requests using recorder. Steps:

  1. To Add a Performance Test Left Click your project and open Add > Web Performance Test.

Note: A Web Test will be automatically added and you can also rename that if desired

  1. If recorder opens close it otherwise simply left click your test and click “Add Web Service Request” .

 

  1. Change local host post method to user Web service address from properties at left pane

 

  1. In Body Properties Select Content Type as Text /XML and in String Body provide your XML .

E.g. Please note use SOAP 1.2 Request as we are using .net frame work 4.0 or 4.5 Click ok

Parameterize script

As we know in load Test will simulate multiple Users therefore in some cases all user need a unique data set therefore it’s very important to Parameterize Request. To this following steps are required to be done

  1. We require a data source to bind our parameter with a data in Excel or SQL Server Table. To do this Create a data source by click highlighted Icon.
  2. If you want to fetch data for parameters from a CSV file select CS else select Data base.

In case of SQL Server create a connection with D.B by performing required steps and at last selecting table.

  1. Now open the web service body XML and for parameterizing a parameter type in its tag {{DataSource.Name of CSV file .Field Name}} g. {{DataSource1.test#csv.ID}}

This way parameterize all required parameters of web service.

Chapter 3: Creating Load test against Performance test

Add load test

Now after creating a performance test you need to create a load test against it. To do so perform following steps. Steps:

  1. Left click project and open

 

  1. A window will open click next

Name your scenario , Select Think time  and click Next         Select Users count as per your requirement and test machine specifications.   Select Test Model Add your Performance Test By clicking add which would be included in Load test   Select Your test   In this way configure your load test and continue

Executing load test.

After Doing All configurations simply start Load test When load test will start following graphs will be shown

Generating Report

There are different ways of generating a load test report one is to automatically creating report using excel and second one is preparing report your self-having only required data what I normally require is response time and its graphs I simply make  report like the one mentioned below in email form but it depends on need .

Advertisements

2 thoughts on “Load Testing with Visual Studio

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s