> For the complete documentation index, see [llms.txt](https://dotnetweb30-ke.gitbook.io/ke/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dotnetweb30-ke.gitbook.io/ke/verification/automated-testing-frameworks-tools-libraries/.net-unit-test-frameworks-overview.md).

# .NET unit test frameworks overview

In .NET we have 3 dominant unit test frameworks:

* **MS Test**
* **NUnit**
* **xUnit**

First one comes with Visual Studio, two other requires additional components installation.

### Unit Testing Frameworks Comparison

| <p><br></p>                | **NUnit**                                                                                                                               | **xUnit.net**                                                                          | **MSTest**                                                                                                |
| -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
| Introduction               | actually ported from a Java testing framework named “JUnit”. It’s a mature framework with a long history started from JUnit since 1998. | relatively new testing framework, written by original inventor of NUnit v2.            | The evolution of Microsoft's Test Framework                                                               |
| Source Code                | <https://github.com/nunit/nunit>                                                                                                        | <https://github.com/xunit/xunit>                                                       | <https://github.com/Microsoft/testfx>                                                                     |
| Supported Platforms        | <p>– .NET Framework 2.0+<br>– .NET Standard 1.6+<br>– .NET Core</p>                                                                     | <p>– .NET 4.5.2 +<br>– .NET Core 2.1+</p>                                              | <p>– .NET 4.5.0+<br>– .NET Core 1.0+ (Universal Windows Apps 10+, DNX Core 5+)<br>– ASP.NET Core 1.0+</p> |
| .Net Core Support          | YES                                                                                                                                     | YES                                                                                    | YES                                                                                                       |
| IDE Tools Support          | Visual Studio, Visual Studio Code, Resharper                                                                                            | Visual Studio, Visual Studio Code, Resharper                                           | Visual Studio, Visual Studio Code, Resharper                                                              |
| CI Tools Support           | TeamCity, VSTS, MSBuild, [CuiseControl.net](http://cuisecontrol.net/), Bamboo, Jenkins                                                  | TeamCity, VSTS, MSBuild, [CuiseControl.net](http://cuisecontrol.net/), Bamboo, Jenkins | TeamCity, VSTS, MSBuild, [CuiseControl.net](http://cuisecontrol.net/), Bamboo, Jenkins                    |
| Parallel Execution         | YES                                                                                                                                     | YES                                                                                    | YES                                                                                                       |
| Execution Isolation Level  | Per test class                                                                                                                          | Per test method                                                                        | Per test class                                                                                            |
| Extensible Test Attributes | NO (Test and TestCase attributes are sealed)                                                                                            | YES (Theory and Fact attributes are extensible)                                        | No                                                                                                        |
| Documentation              | Highly documented                                                                                                                       | Not too much                                                                           | Documented Well                                                                                           |

### Unit Testing Implementation Comparison

|                                                       | **xUnit Test**                                                                             | **MS Test**                                             | **NUnit Test**                                                            |
| ----------------------------------------------------- | ------------------------------------------------------------------------------------------ | ------------------------------------------------------- | ------------------------------------------------------------------------- |
| Class                                                 | No                                                                                         | \[TestClass]                                            | \[TestFixture]                                                            |
| Single Test Case                                      | \[Fact]                                                                                    | \[TestMethod]                                           | \[Test]                                                                   |
| Multi-Data                                            | <p>\[Theory]</p><p>\[InlineData]</p>                                                       | <p>\[DataTestMethod]</p><p>\[DataRow]</p>               | \[TestCase]                                                               |
| Repeat Initialization for each Test                   | Ctor, IDisposable                                                                          | <p>\[TestInitialize]</p><p>\[TestCleanup]</p>           | <p>\[SetUp]</p><p>\[TearDown]</p>                                         |
| One Time initialization for all tests in one class.   | <p>\[MemberData]</p><p>Or</p><p>\[ClassData]</p><p>Method Member (may Property Member)</p> | <p>\[ClassInitialize]</p><p>\[ClassCleanup]</p>         | <p>\[OneTimeSetUp]</p><p>\[OneTimeTearDown]</p>                           |
| One Time initialization for all tests in one assembly | \[MemberData] Or \[ClassData] Property Member                                              | \[TestClass] + \[AssemblyInitialize] \[AssemblyCleanup] | Dedicated class with \[SetUpFixture] + \[OneTimeSetUp] \[OneTimeTearDown] |
