Difference between Microsoft.VisualStudio.TestPlatform.TestFramework and Microsoft.VisualStudio.QualityTools.UnitTestFramework

13,770

MSTest has been released as a new NuGet package solution that is no longer tightly coupled to the Visual Studio version. Your new projects are using MSTest 2.0.

MSTest V2 release annoucement: https://devblogs.microsoft.com/devops/taking-the-mstest-framework-forward-with-mstest-v2/

Share:
13,770
SwissCoder
Author by

SwissCoder

Updated on July 07, 2022

Comments

  • SwissCoder
    SwissCoder almost 2 years

    I noticed a change in one of our solutions in VS 2015 today. It seems the test projects that are generated for the solution use a different namespace than the existing test projects in the same solution.

    Only the test projects that reference

    Microsoft.VisualStudio.QualityTools.UnitTestFramework

    are recognized as test projects within Visual Studio 2015.

    However there are now some test projects referencing

    Microsoft.VisualStudio.TestPlatform.TestFramework Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions

    It's possible that these test project where generated from VS 2017 RC. This would explain the different namespace. I didn't find any docs about backward compatibility.

    Question is, which namespace to use? As we can't use both namespaces at the same time. What are the differences between the two namespaces?

    VisualStudio 2015 is able to build the test projects with either reference. To switch the newer namespace back to the older namespace only because of the test project generation is not reason enough I think.

  • O. R. Mapper
    O. R. Mapper over 3 years
    I'm very confused now ... the post lists yet another set of namespaces than the ones from the question: Microsoft.VisualStudio.TestTools.UnitTesting and Microsoft.VisualStudio.TestPlatform.UnitTestFramework apparently being old, while, according to your answer, they should be new and referring to MSTest 2.0. The linked release announcement points out MSTest 2.0's namespace should be Microsoft.VisualStudio.TestTools.UnitTesting. Or did I misinterpret anything there?
  • jessehouwing
    jessehouwing over 3 years
    Use the NuGets. Stick to those. Easiest way is to delete all the references and add the nuget. It will add the right assemblies and intellisensi will tell you what to use.
  • O. R. Mapper
    O. R. Mapper over 3 years
    That strategy isn't helpful if you'd like to understand what you're doing, or when you need to get existing code to run as it is without changing it.
  • jessehouwing
    jessehouwing over 3 years
    The assemblies being referenced are part of Visual Studio (pre 2015), and they changed... By keeping the older version of Visual Studio installed and explicitly referencing the old assemblies, the code will build, but it may not be detected by the Visual Studio Test Runner in Visual Studio 2015 and above.
  • O. R. Mapper
    O. R. Mapper over 3 years
    Uh-oh, not conductive to sharing code in a team with heterogenous software environments.
  • jessehouwing
    jessehouwing over 3 years
    True. You can always choose to keep using VS2013. But that's 7 years old now and a lot has changed. Infinite backwards compatibility would have withheld a lot of progress. The changes are minor and once done will likely speed up your test cycle as well.