In .NET Core under Visual Studio 2015 one had to create a unit test project that was based on xunit, though the command line (no dedicated project was available in Visual Studio for .NET Core).
In Visual Studio 2017, under .NET Core section there are now 2 types of unit testing projects available:
What is the difference between them? What is the recommended one these days?
As far as NUnit vs. XUnit vs. MSTest is concerned, the biggest difference between xUnit and the other two test frameworks (NUnit and MSTest) is that xUnit is much more extensible when compared to NUnit and MSTest. The [Fact] attribute is used instead of the [Test] attribute.
On the Create a new project page, type unit test into the search box. Select the project template for the test framework that you want to use, for example MSTest Test Project or NUnit Test Project, and then select Next. On the Configure your new project page, enter a name for your project, and then select Create.
xUnit is far more flexible and extensible than the other . Net Unit test frameworks. It allows you to create new attributes to control your tests. It ensures custom functionality with the possibility of extending the Asset class's Contains, DoesNotContain Equal, NotEqual, InRange, & NotInRange.
Unit Test Project
has MSTest V2 framework installed.
xUnit Test Project
has xUnit.
It's just two different test frameworks.
Unit Testing in .NET Core.
They are completely 2 different Unit Test Frameworks. There is some basic information/documentation available for xUnit at http://xunit.github.io for xUnit but not a full one. The answer to: "What is the recommended one these days?" It depends on your personal preference. I prefer xUnit because xUnit integrates well with Visual Studio and is used by Microsoft team to test .net core. You can chose whichever you find suitable.
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