Is xUnit is a modern and future proof solution for unit testing? I’m measuring pros and cons of xUnit and NUnit for the big and old legacy application. At the first go I thrown away MsTest because the more efforts are required to do the same things. Also it is not as extendible as others. The main question is whether xUnit is ready enough to production and future proof tool.
The Findings
On the one hand, NUnit is old and reliable tool with almost all required features. On the other hand, xUnit declares the same features as NUnit, but in more organic manner for developers. For instance, without some useless attributes or uses different names for same things, but in the nutshell they are quite similar. I couldn’t found any essential benefits of xUnit before NUnit, except related to peoples’ mindset. They could be expressed in this way:
- xUnit is a unit testing framework for ASP.NET 5, though MSTest still will be on the table.
- xUnit’s terminology adheres TDD closely (Fact, Theory)
- xUnit is fresh and modern
There are a lot of resources in the web about that, but there is no any useful enough though. These are the most informative:
- Why did we build xUnit.net
- Top 10 Changes in ASP.NET 5 and MVC 6
- NUnit vs. MbUnit vs. MSTest vs. xUnit.net on StackOverflow
- outdated, but still something is true NUnit vs MSTest vs xUnit Comparisons
Both tools have support of asynchronous tests (xUnit, NUnit). Although I’d like to have ability to configure via attributes a scenario when a single test method could be ran in several threads simultaneously. I didn’t find that for these testing framework.
Both have support in Visual Studio and CI tools by means of plugins.
Wrapping Up
In the end I consider them quite similar. Both frameworks are reliable for the production. I suppose the choice between them should rely on team’s skills. Nevertheless if you’d like to show your team as a modern and innovative choose xUnit.
If you know a scenario when xUnit lose to NUnit, please, let me know.