What is actualy the difference between MSTest.TestAdapter
vs MSTest.TestFramework
and when do I need which one?
In the NuGet descriptions you can read:
MSTest.TestAdapter
The adapter to discover and execute MSTest Framework based tests.
MSTest.TestFramework
This is MSTest V2, the evolution of Microsoft's Test Framework. + To discover and execute tests install MSTest.TestAdapter.
Well, not very helpful and I always install both because I'm never sure which one I should take. Strangely that in one of my test projects I only have the MSTest.TestFramework
(I guess by accident) and ReSharper still can discover tests.
My questions about these packages are:
TestAdapter
?TestFramework
? When would I need this one?The project page on GitHub doesn't help much either. The only link
You can read more about MSTest V2 here.
navigates to a page that only says how great and open-source it is but nothing specific about either of the packages.
MSTest is Microsoft's tool used to run tests of . NET applications (in particular, it can be used for unit testing). In TestComplete, you can integrate your MSTest tests to your test projects and run them as part of your automated testing process.
So Visual Studio uses a framework called Visual Studio Test Platform to load test adapters,
https://github.com/Microsoft/vstest
To discover or execute test cases, VSTest would call the test adapters based on your project configuration. (That's why NUnit/xUnit/MSTest all ask you to install a test adapter NuGet package to your unit testing projects). So MSTest.TestAdapter exists for that purposes.
MSTest.TestFramework itself implements the testing frameworks and its contracts. So you need to add a NuGet reference of it in order to write unit test cases and have them compiled. Only compiled projects along with the test adapter can then be consumed by Visual Studio.
So the final answer to your question would be "you usually need both".
The other answer from @Nkosi of course can be right if you don't ever plan to use Visual Studio. MSTest has its own command line runner, which can run your unit test project without the test adapter.
Do you really always need to install both of them?
No. Why? (See below)
Why does it work even without the TestAdapter?
There are other adapters/runners out there that can recognize MSTest framework and that can also discover and run MSTest Framework tests.
What can I do with the TestFramework?
So in general a test framework is one used to create/author your tests while adapters/runners discover and exercise discovered tests.
When would I need this one?
There are multiple frameworks and adapters/runners and you use the one of your choosing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With