Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2013 MSTest vs NUnit

My company is upgrading our Visual Studio 2012 to 2013 Premium. In the midst of this, we are also looking to start automating our tests using Visual Studio Team Services

I have read a couple of MSTest vs nUnit posts and articles in the past but most of it compares the older version of MSTest. Also, nUnit had a lot of favourable reviews as compared to MSTest.

My question is, considering Microsoft's commitment towards the ALM, Agile practices and all the new stuff they've added into VS2013 Premium and Visual Studio Team Services to facilitate and encourage automated testing, how does MSTest compare to nUnit?

What other considerations should I take before making a decision on a testing framework to use?

like image 617
Null Reference Avatar asked Mar 26 '14 02:03

Null Reference


People also ask

Should I use NUnit or MSTest?

The main difference is the ability of MsTest to execute in parallel at the method level. Also, the tight integration of MsTest with Visual Studio provides advantages in both speed and robustness when compared to NUnit. As a result, I recommend MsTest.

What is difference between NUnit and unit testing?

NUnit is an older, more established unit testing framework designed to do exactly one thing - unit testing. MSTest is newer so it does not have the same level of maturity in its API. For example, NUnit offers more Assert methods than MSTest.

Is MSTest a testing framework?

MSTest framework for Selenium automated testing is the default test framework that comes along with Visual Studio.

Does MSTest work with .NET core?

In this article, I will explain about the unit test in asp.net core using MSTest. There are three different test frameworks which are supported by the unit test with asp.net core: MSTest, xUnit, and NUnit, which allow us to test our code in a consistent way.


2 Answers

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.

like image 83
Mark Seemann Avatar answered Oct 12 '22 00:10

Mark Seemann


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 a paid tool).
  3. MSTest has an option to execute your tests in parallel if they don't depend 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 the method.
  5. NUnit is faster as compared to MSTest.

Overall both frameworks are good to use, but I'd suggest going for NUnit.

like image 37
arpitbakshi Avatar answered Oct 12 '22 02:10

arpitbakshi