We're Hiring!
Take the next step in your career and work on diverse technology projects with cross-functional teams.
LEARN MORE
Mountain West Farm Bureau Insurance
office workers empowered by business technology solutions
BLOG
7
25
2016

Load Testing WCF Services using Visual Studio – Part 1

Last updated:
7.13.2021

This is a two-part series that covers using Visual Studio to load test a WCF service. In part one of this series I will cover how to create a project and unit tests; part two covers creating and executing the load test.

A recent project involved the development of several Windows Communication Foundation (WCF) services, my role was Lead Software Tester. I was charged with not only testing them for quality but also load testing the services. In this article I’m going to cover how we approached load testing the WCF services using Visual Studio 2013. The benefit of using Visual Studio is that, among other things, there are a number of features available for both orchestrating the tests as well as producing useful charts and graphs for analysis.

Our client provided us an SLA in terms of required throughput, so we calculated the necessary performance needed to achieve the throughput across all services. Acceptance criteria specifically stated the solution being developed would need to meet this SLA.

Getting Started

As soon as the development team started producing services, it was time for the testing team to begin to measure the performance of these services against the SLA. I started by creating a Visual Studio 2013 project comprised of the following:

Creating the Project

I created a project based on the Web Performance and Load Test Project template. This is where I will create the unit tests for the various methods in each WCF Service. The reason to use the Web Performance and Load Test Project template is, as you Add new items to the project you see all the available testing items from which to choose (See Figure 1).

MM_201604_AddItem.png
Figure 1 - Available Items you can add in the Web Performance and Load Test Project template

Before creating a coded unit test, I’ll need references to the services. Once the references have been added, I’ll be ready to create unit tests for each of the service methods.

Creating unit tests

The unit tests will be used in the load tests but need to be created before we can create a load test scenario. Figure 2 shows an example coded unit test that calls the service. As most unit tests do, I was sure to include Assert statements that provided me with the necessary success or failure status of the test. Note that when a response is received and the response does not contain “fault” the test succeeds and when an exception is caught the test is automatically failed. These results are neatly passed to Visual Studio for presentation in the Test Explorer; shown in Figure 3.

MM_201604_Code.png
Figure 2 - Unit test method

Once all necessary unit tests have been created, build the solution. When the solution is successfully built, all the tests are discovered and become visible in the Test Explorer. See Figure 3. The Test Explorer shows the available tests and their status. This is also a good time to individually execute the tests and ensure they are running as expected. Note: It is important to build the solution once before trying to create a load test otherwise your tests won’t appear in the Test Explorer or be available for selection in the load test wizard.

MM_201604_TestExplorer.png
Figure 3 - Test Explorer showing available test methods and status

The Test Explorer is a great way to spot check the tests by executing them and reviewing the results.

Summary

This article showed how to create unit tests that can be used as components of a load test in Visual Studio. Part 2 of this series will show how to use these to build a load test and measure the performance of the solution.

Recent Blog Posts

lunavi logo alternate white and yellow
11.19.2024
11
.
8
.
2024
Load & Performance Testing with Azure Load Testing Service

Learn about load and performance testing in Microsoft Azure.

Learn more
lunavi logo alternate white and yellow
10.8.2024
09
.
25
.
2024
Maximizing Business Efficiency with Azure DevOps

For enterprises looking to adopt or mature their DevOps practices, Azure DevOps offers unmatched flexibility, scalability, and depth.

Learn more
lunavi logo alternate white and yellow
10.8.2024
09
.
09
.
2024
Exploring Microsoft Fabric: A Comprehensive Overview

Discover how Microsoft Fabric transforms data management and analytics with powerful tools for real-time insights and seamless collaboration, driving smarter, faster business decisions.

Learn more