Visual Studio 2013 MSTest vs NUnit

此生再无相见时 提交于 2019-11-29 19:48:02
Mark Seemann

MSTest hasn't changed much since it was originally introduced, so those old comparison posts are still valid. Microsoft's focus on ALM is mostly targeted at further tooling and server products, but the fundamental testing framework hasn't changed much.

It's also worth noticing that MSTest and their entire ALM strategy is targeted at many different styles of automated testing, including Integration Testing, System Testing, Performance Testing, etc., so while it attempts to be a one-size-fits-all, it's quite ill-suited for unit testing, because it's too heavy to work with.

While NUnit is better, I wouldn't recommend it either. It, too, hasn't changed much for years, and the extensibility model is frankly a mess.

Instead, I'd recommend xUnit.net. Although it's not perfect either, it's currently the best mainstream alternative on .NET. There are many reasons why xUnit.net is better than MSTest.

arpitbakshi

MSTest Vs NUnit:

  1. MSTest is integrated with VS so it'll be easy to use. NUnit will require third party tools (some are free, some are paid).
  2. VS will give you Code Coverage in MSTest. NUnit requires DotCover (which is paid tool).
  3. MSTest has a option to execute your tests in parallel if they don't dependent on each other. This isn't a feature that NUnit provides.
  4. NUNit has TestCaseSourceAttribute which helps you to achieve parametrized test cases but in MSTest you'll need DataSourceAttribute which would be in xml file and will be difficult to manage when you have complex logic in method.
  5. NUnit is faster as compared to MSTest.

Overall both frameworks are good to use, but i'd suggest to go for NUnit.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!