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
“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 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.
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
Visual Studio Ultimate
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
Open Visual Studio Instance
Create a New Project By clicking New > Project….
Click “Test” and then select “Web Performance and Load Test Project” with C#, Provide any Suitable name and click “OK”.
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.
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
Now to Start Recorder Click Record icon On Visual Studio It will start recorder in IE.
Perform you Steps and recorder will automatically record HTTP Request
Here I am Performing
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.
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
Identify Fields / Parameters e.g. in sign in two parameters must be dynamic ID and Password.
Expand Your Request which is having parameters.
As you can see Password and ID, These two Parameters are needed to be dynamic
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.
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.
After adding data source view will be like this.
Left Click Parameter and expand list and then select field of table in data source here I am selecting from CSV
Expand data source
Now parameter value will look like this
Save you r test