Testing is essential for monitoring the health of a software application or product. It is very important to ensure that the application will not result in any un-expected behavior or failure.
Testing helps in maintaining the Quality of the product or application and makes the application defect free. It also finds any gaps or missing requirements in the application.
The First type of testing normally done is Functional testing.
Functional testing ensures that the application is working as expected. Many of the applications under development are web applications or web services. Most of these application now-a-days run for a long duration, for many concurrent users, over many networks and across many browsers.
While testing the app, we need to find out the application’s performance by taking it to a real-world scenario where there are any number of users, networks, as well as different browsers. This type of testing is called Load Testing.
Load testing helps us give an analysis of performance counters on servers when loaded to the point of actual load and beyond.
Load Testing will help us identify if there is any performance degradation when high number of users execute the same application at the same time.
In a previous article, I discussed Performance Testing with Azure Portal. In this article, I will discuss Load Testing and its features in Visual Studio Team Services (VSTS).
Datadog, a monitoring and analytics platform that integrates with more than 250 technologies, unites metrics, traces, and logs in one platform so you can get full visibility into your infrastructure and applications. With powerful dashboards, anomaly and outlier detection, and distributed tracing, Datadog helps you get a handle on the performance of your .NET applications, as well as their underlying infrastructure.
Click here to try Datadog’s full-stack monitoring for free! (No Credit Card required)
Load Testing and its features in Azure DevOps (formerly VSTS)
Load Test does support testing of URL based REST APIs. But an important feature which Load Testing with Test hub does not provide is to have dynamic information. In this situation we need to run the tests using Visual Studio.
a. Visual Studio Team Services (VSTS) account
b. A Web Performance Test created using Visual Studio 2017 Enterprise
If you do not have VSTS account go to https://www.visualstudio.com, click on Get Started for Free for Visual Studio Team Services and follow.
Once a VSTS account is created, we can add a Team Project in it. The Load Test tab can be found as follows
<Team Project Name> – Test
Let us discuss these tests one by one.
Load Test HTTP Achieve (HAR)
We can use HAR testing to create load tests for end-to-end scenario.
Visual Studio Load Testing will give us maximum capabilities, but HAR also provides some limited features. We can write tests which can support multiple URLs.
Let us find out how to create HTTP Achieve file. I have done it using Microsoft Edge but you can also use it in Chrome, Firefox or Internet Explorer.
Launch a browser and click on F12 to open developer tools
You can preserve the logs if required as follows:
Follow the scenario you want to test, enter the url in the address bar. I am going to use Web App Service for EMS app
As you proceed with your application, the traffic is shown in the Network tab.
- After you have finished, you can store this as a HAR file by clicking on the Export button
Now that the HAR file is ready, you can create a Load Test based on this file. Browse to the location where the file is stored
Save the file. Now you can set the settings for this scenario like run duration, load patterns (constant or step), browser mix, number of virtual users etc.
The URLs we had specified at the time of creating HAR file will be picked up. We can do any editing if required.
Once the changes are made and the file saved, we can run the tests. The data after the run will be available in Diagnostics and Logs tab. If the test fails, we can find more information from these logs.
Here are some charts after running the tests:
The diagnostics can be seen as follows:
We can even export the test to Visual Studio 2017 Enterprise and add more capabilities to it.
Load Testing with Visual Studio 2017 Enterprise
- We can export the HTTP archive file into Visual Studio Load Test or create a standalone load test in Visual Studio. Load testing comes after functional tests are written and tested. We need to provide a mix of functional tests (their load), browser mix, network mix, step or constant load for users.
- We can run this load test either by using on-premises load agent or controller or Test Hub. I will write more on creating load test with Visual Studio 2017 Enterprise in an upcoming article.
- With test hub, we can select the option for Visual Studio Test and can browse to the folder where the test is available. Any Web Performance test created earlier can be selected for this.
- Once the test is selected we can change the settings and run it any time
URL based Load Testing
- Select the option for URL based test and provide the name for the test.
- You can provide a URL you want to test in URL text box. You can add multiple URLs and specify method for each like POST or PUT. You can also add headers and query string if these are required to be sent as values to the requests.
- You can then set the settings and run test
Apache JMeter Testing
It can find out the maximum number of concurrent users a web application can handle. Once you have a JMeter test, you can easily execute it with VSTS.
In this load testing tutorial, I discussed what is Load Testing and how VSTS Test hub provides different types of Load Testing.
This article has been editorially reviewed by Suprotim Agarwal.
C# and .NET have been around for a very long time, but their constant growth means there’s always more to learn.
We at DotNetCurry are very excited to announce the The Absolutely Awesome Book on C# and .NET. This is a 500 pages concise technical eBook available in PDF, ePub (iPad), and Mobi (Kindle).
Organized around concepts, this eBook aims to provide a concise, yet solid foundation in C# and .NET, covering C# 6.0, C# 7.0 and .NET Core, with chapters on .NET Standard and the upcoming C# 8.0 too. Use these concepts to deepen your existing knowledge of C# and .NET, to have a solid grasp of the latest in C# and .NET OR to crack your next .NET Interview.
Click here to Explore the Table of Contents or Download Sample Chapters!