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

Share on facebook
Share on twitter
Share on linkedin

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 tracability 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.


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


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

More to explore

4 Responses

  1. Hi! Have you gotten test case association manager to work where the test associations are successfully completed between test case work items and test methods? If it is working are you using the test context test name for the method name when creating the work item with the same name? Also, once you create a test plan and add the test cases to the test plan is there anything else that needs to be configured to make the association work? We are having issue with making the associations. We have followed the directions for this tool as specified in the Azure DevOps Market Place. We are erroring out when Validating Project Test Methods with the Test Case work items. Your thoughts would be very much appreciated…Thanks!

    1. Hi Steve, I have not tried this extension yet. I saw that you posted a couple questions there too. It would be nice if they would reply. I’ll try to take a look and let you know.

Comments are closed.