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
3.13.2025
3
.
12
.
2025
Unlocking the Power of Azure Managed Services with Lunavi

Cloud computing has become the backbone of modern business, offering agility, scalability, and cost efficiency. But managing cloud environments while keeping costs under control and security airtight? That’s a challenge. Azure Managed Services streamline cloud operations, helping businesses optimize spending, enhance security, and future-proof applications. Lunavi provides the expertise and tools to make it happen—so you can focus on growth instead of IT headaches.

Learn more
lunavi logo alternate white and yellow
2.11.2025
2
.
7
.
2025
The Future of Test Automation: Key Trends Shaping 2025 and Beyond

Software testing has gone from a chore to a game-changer, thanks to automation. But in 2025, sticking to old methods means falling behind. Stay ahead by embracing the future of test automation—let’s explore the key trends shaping what’s next.

Learn more
lunavi logo alternate white and yellow
2.11.2025
1
.
23
.
2025
The Importance of Cross Browser Testing

Making sure users have a smooth experience across all these platforms is crucial for businesses to stay competitive. Cross-browser testing is now a key part of modern development. It helps teams find and fix problems like layout issues, broken features, or slow performance before users are affected. Let’s look at why cross-browser testing matters and explore tools that make it easier to get the job done.

Learn more