Difference between Microsoft.VisualStudio.TestPlatform.TestFramework and Microsoft.VisualStudio.QualityTools.UnitTestFramework
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/
SwissCoder
Updated on July 07, 2022Comments
-
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 over 3 yearsI'm very confused now ... the post lists yet another set of namespaces than the ones from the question:
Microsoft.VisualStudio.TestTools.UnitTesting
andMicrosoft.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 beMicrosoft.VisualStudio.TestTools.UnitTesting
. Or did I misinterpret anything there? -
jessehouwing over 3 yearsUse 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 over 3 yearsThat 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 over 3 yearsThe 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 over 3 yearsUh-oh, not conductive to sharing code in a team with heterogenous software environments.
-
jessehouwing over 3 yearsTrue. 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.