Tip

Everything you need to know about testing .NET applications

For the most efficient testing, you need the right tools for the job. Expert Matt Heusser explains in detail all the testing tools for tackling apps built with Microsoft's .NET.

Testing an application for the outside, as a black box, can be as simple as creating scenarios, running them and looking to see if the results match. Modern testing generally involves getting below the surface, testing integration points, application setup and, often, automating repetitive behaviors. Testing .NET applications in this way can be especially challenging because of its propriety nature and close ties to the operating system, and, likely, web server and database servers. This article covers the tools and techniques you'll need to test .NET applications.

The .NET platform

While often used as an umbrella term for Microsoft programming tools, the core elements of .NET are a Common Language Runtime that allows nearly any language to compile down to an intermediate language, combined with a Framework Class Library that provides core functions for any language.

Those two things mean that programmers can write code in C#, C++, Visual Basic and a host of other languages that can be used for web applications, Windows, mobile devices, the command line or even to create APIs. Best of all, the languages can link together, allowing a Visual Basic programmer to extend a C# program.

On the down side, the user interface can include automatically created code and special values. Any tools that want to get below the GUI will need to understand how the .NET framework works.

Test tools for .NET

Visual Studio -- Microsoft's main integrated development environment, Visual Studio is the place that programmers live in to create applications. Most Microsoft test tools extend Visual Studio to do test case management, test automation or project management.                                                                                                                                           

Test Case Management -- A part of Visual Studio Enterprise, Microsoft Test Manager is a sort of repository of coverage: what test ideas exist (sometimes called "Test Cases"), along with the runs of those test ideas. Test Manager is integrated with Excel or Word and supports exploratory testing, including tools to view a test run or collect diagnostic data while performing a test.

Team Foundation Server -- A wrapper so teams can work to deliver applications together, Team Foundation Server (TFS) provides version control, project management and application lifecycle management services. For example, the programmers create the code in Visual Studio for a given story, store it in TFS and then can track time against TFS. A tester could create test cases in Microsoft Test Manager and "link" those to a particular story in TFS. TFS also includes the capability to create builds, acting as a continuous integration server.

With the right tools, investigating and testing, .NET applications can be easier, faster and less painful.

Automated test execution -- Coded UI is a Microsoft tool that can record a test run, set assertions about what the text could contain, then generate C# code to execute the test. This C# code exists in a test project in Visual Studio; testers can run the test by pushing a button or edit the code to build C# code libraries to perform repetitive function. Creating sample code automatically that exists in the same programming language as the production programmers are using makes tester/programmer collaboration much easier.

Virtual machines -- The technical staff will likely want to test old versions of Microsoft browsers and operating systems. Purchasing a new computer per person, per browser and operating system can be expensive, so Microsoft provides free virtual machines for testing. The downloadable machines are essentially the disks to an operating system -- they need a hypervisor to run on, such as VirtualBox, which is free and open source.

NUnit -- A free, open unit test tool for C# that is becoming the standard. Programmers that create a test project in Visual Studio can write NUnit tests in the same style as Java's JUnit and Smalltalk's xUnit -- the original unit-testing framework.

Selenium WebDriver -- A free, open GUI test program that can run in C#. The most common use of WebDriver in Visual Studio is probably in a test project in NUnit with NuGet.

Microsoft's own employees and product managers have created a wide variety of other test tools, some that come with Visual Studio, most others are free or included with a Microsoft Developer Network subscription. Supported platforms, technical support and price all vary.

Going beyond the Microsoft ecosystem

There are a variety of tools that could work with testing .NET applications. As we mentioned before, the core issue is the depth of integration. Because Microsoft changes .NET all the time, most tools tend to lag behind, supporting the previous version of the operating system, browser or version of Microsoft Visual Studio just as the next version appears.

Most tools are either free or include a 30- to 90-day trial, so download the tool and attempt to use it with your software. At the same time, when testing .NET applications, look at the versions of the .NET, Internet Explorer, Edge, operating system and devices supported. Also look at what support means; you might try dialing in before the software expires with a prefabricated platform problem to get a feel for wait time, depth of expertise and general attitude.

Many general test tools work well with .NET applications. As of late 2016, SmartBear Software's TestComplete, Hewlett Packard Enterprise's Unified Functional Tester and the Telerik test tools have hooks to go deeper into testing .NET applications. Telerik's format for tests is C#, which programmers can modify "under the hood" if they wish.

In the final analysis, testing .NET applications is very similar to other applications. With the right tools, investigating and testing, .NET applications can be easier, faster and less painful. That's a prescription for more accurate testing done earlier.

Next Steps

Choose from a wide range of test case management tools

Get your tech on -- take testing to a new level

So, testers, want to learn to code? Here's how to get started

Will .NET 6 features bridge the gap between .NET frameworks?

Dig Deeper on Software testing tools and techniques