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
5
18
2018

Test Case Association to xUnit, NUnit, and MSTestV2 Tests is available in Visual Studio 2017 15.7.1

Last updated:
7.13.2021

11/20/2018 Update - The Associate to Test Case option is working again in 15.9.2! I didn't get a chance to try 15.9.1 to know if it worked with that version or not. I'll keep this updated if the behavior changes.

9/04/2018 Update - The Associate to Test Cases option has been disabled again in 15.8.0, 15.8.1, and 15.8.2. Other workarounds are to reference the MSTestV1 (Microsoft.VisualStudio.QualityTools.UnitTestFramework) and remove MSTestV2 references when doing the associate or use the API for doing the association.

The "truth center" of detailed requirements for projects should be represented as tests or sometime also refereed as executable requirements. Traditionally we have accomplished this using the following "Test Case First" process.

User Story (Desirement) > Acceptance Criteria (Informal detailed requirements) > Test Cases (Work Item with Given, When, Then)

We then create the UI or API automated functional test and associate the automated test with the Test Case Work Item. This gave us a great amount management and reporting capabilities for test cases and provided a consistent way to work with manual and automated tests. However, one downside to this approach is that this has only worked with MSTestV1. Other test frameworks have become more popular such as xUnit and NUnit and even Microsoft introduced MsTestV2. The problem is that none of these other frameworks would work. The Associate Test Case Option has been disabled. Note: Even though these are unit test testing frameworks, these frameworks are often used for writing and running functional UI and APIs through code and linking to other testing tools like TestArchitect and SoapUi.

The DevOps movement has been pushing activities like testing upstream to the developers with the focus to automate all tests. One could argue that having a Test Case work item and an automated test with the details of the requirements is redundant. Which is the truth? As teams want to move faster, they skip the test case and use the automated test and test results as the test case itself. VSTS allows for the test results to be associated to requirements to still provide traceability and to be able to show test quality at the requirement level.

With Visual Studio not supporting the ability to associate test cases to xUnit, NUnit, or MSTest V2 tests, this has forced teams to abandon the test case first approach and to use the requirements. I have been following this thread on Visual Studio Developer Community website where it was mentioned that this functionality is available with Visual Studio 15.7.1. I'm excited to report that you can now associate Test Cases to all three of these frameworks and possibly other others. I created a Unit Testing Solution with 3 projects representing each of these tools. I was able to associate all of the tests and run them through VSTS using the Test Plan option.

Now you can choose the approach that best fits your process and not base it on a tool limitation.

unittest-comparison-project.jpg

In VSTS, the Visual Studio Test task has the option to run tests by Test Plan / Test Suite / Test Configuration.

visualstudio-test-task.jpg
vsts-test-results-test-suite.jpg
test-case-results-chart.jpg

As always, reach out to me at twitter at https://twitter.com/mikedouglasdev for any questions or comments.

Recent Blog Posts

lunavi logo alternate white and yellow
9.5.2024
08
.
29
.
2024
Unlock the Future with Data & AI: Why Partnering with Lunavi Makes All the Difference

Learn about the Microsoft Data and AI designation, how Lunavi earned the designation and the power of Data and AI

Learn more
lunavi logo alternate white and yellow
8.7.2024
07
.
31
.
2024
Disaster-Proof Your Business: Automate Recovery with Azure Traffic Manager

Discover how automating disaster recovery with Azure Traffic Manager can significantly enhance your business's resilience and ensure uninterrupted operations during unforeseen events.

Learn more
lunavi logo alternate white and yellow
7.12.2024
05
.
20
.
2024
From Silos to Synergy: Microsoft Fabric's Role in Optimizing Data Use Across Enterprises

In today’s digital environment, the role of data as a strategic asset is undeniable. Organizations across the globe generate vast amounts of data, but unfortunately, a significant portion of this potential goldmine remains unused. With Microsoft Fabric, you can make the most of your data and eliminate organizational silos!

Learn more