load testing with vs 2013

28
0 HTTP:// FAHAD SHEIKH 0 LOAD TESTING WITH VISUAL STUDIO Fahad Sheikh [email protected] http://testingtoolstecniques.blogspot.com/

Upload: fahad-shiekh

Post on 26-May-2015

202 views

Category:

Software


4 download

DESCRIPTION

This user guide explains how to test a web service and web applications using Micro Soft Visual Studio

TRANSCRIPT

Page 1: Load testing with vs 2013

HTTP://TESTINGTOOLSTECNIQUES.BLOGSPOT.COM/

Fahad Sheikh 0

0

Fahad Sheikh

http://testingtoolstecniques.blogspot.com/

Page 2: Load testing with vs 2013

Fahad Shaikhhttp://testingtoolstecniques.blogspot.com/

Page 3: Load testing with vs 2013

Fahad Shaikhhttp://testingtoolstecniques.blogspot.com/

Table of ContentsChapter 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

http://testingtoolstecniques.blogspot.com/

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.

Page 4: Load testing with vs 2013

Fahad Shaikhhttp://testingtoolstecniques.blogspot.com/

Difference Between load and performance testPerformance 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.

Page 5: Load testing with vs 2013

Fahad Shaikhhttp://testingtoolstecniques.blogspot.com/

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

Page 6: Load testing with vs 2013

Fahad Shaikhhttp://testingtoolstecniques.blogspot.com/

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 ProjectFirst 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”.

Page 7: Load testing with vs 2013

Fahad Shaikhhttp://testingtoolstecniques.blogspot.com/

4. After Creating Project

Creating a Performance Test Using RecorderSecond 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 2. Now to Start Recorder Click Record icon On Visual Studio It will start recorder in IE.

Page 8: Load testing with vs 2013

Fahad Shaikhhttp://testingtoolstecniques.blogspot.com/

3. 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 screenAfter Recording Click STOP.

Page 9: Load testing with vs 2013

Fahad Shaikhhttp://testingtoolstecniques.blogspot.com/

4. 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 scriptAs 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

Page 10: Load testing with vs 2013

Fahad Shaikhhttp://testingtoolstecniques.blogspot.com/

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

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

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

Page 11: Load testing with vs 2013

Fahad Shaikhhttp://testingtoolstecniques.blogspot.com/

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

Page 12: Load testing with vs 2013

Fahad Shaikhhttp://testingtoolstecniques.blogspot.com/

Now parameter value will look like this

7. 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 ProjectFirst step of creating a load test Project. To-do so perform following steps

Steps:

5. Open Visual Studio Instance

6. Create a New Project By clicking New > Project….

Page 13: Load testing with vs 2013

Fahad Shaikhhttp://testingtoolstecniques.blogspot.com/

7. Click “Test” and then select “Web Performance and Load Test Project” with C#, Provide any Suitable name and click “OK”.

8. After Creating Project

Creating a Performance Test Using RecorderSecond 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:

Page 14: Load testing with vs 2013

Fahad Shaikhhttp://testingtoolstecniques.blogspot.com/

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 2. If recorder opens close it otherwise simply left click your test and click “Add Web Service

Request” .

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

Page 15: Load testing with vs 2013

Fahad Shaikhhttp://testingtoolstecniques.blogspot.com/

4. 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 scriptAs 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

Page 16: Load testing with vs 2013

Fahad Shaikhhttp://testingtoolstecniques.blogspot.com/

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.

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

This way parameterize all required parameters of web service.

Page 17: Load testing with vs 2013

Fahad Shaikhhttp://testingtoolstecniques.blogspot.com/

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

2. A window will open click next

Page 18: Load testing with vs 2013

Fahad Shaikhhttp://testingtoolstecniques.blogspot.com/

Name your scenario , Select Think time and click Next

Select Users count as per your requirement and test machine specifications.

Page 19: Load testing with vs 2013

Fahad Shaikhhttp://testingtoolstecniques.blogspot.com/

Select Test Model

Page 20: Load testing with vs 2013

Fahad Shaikhhttp://testingtoolstecniques.blogspot.com/

Add your Performance Test By clicking add which would be included in Load test

Page 21: Load testing with vs 2013

Fahad Shaikhhttp://testingtoolstecniques.blogspot.com/

Select Your test

In this way configure your load test and continue

Executing load test.After Doing All configurations simply start Load test

Page 22: Load testing with vs 2013

Fahad Shaikhhttp://testingtoolstecniques.blogspot.com/

When load test will start following graphs will be shown

Generating Reporti

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 .

Page 23: Load testing with vs 2013

Fahad Shaikhhttp://testingtoolstecniques.blogspot.com/

References:http://testingtoolstecniques.blogspot.com/

Page 24: Load testing with vs 2013

i You can follow my posts on http://testingtoolstecniques.blogspot.com/