Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there anything I can do in NUnit that I can't do in MSTest?

Tags:

mstest

nunit

This question has been asked in various forms in a number of different forums, but, IMHO, I haven't been able to find a place where it's really answered clearly, so I'm going to reframe it and ask it again.

I work in a basically Microsoft Shop. We use TFS, and all of our developers have MSDN subscriptions including the Team Suite edition of VS. So we have access to MSTest.

I've read the various NUnit vs. MSTest comparisons, and the developer community seems to pretty much overwhelmingly choose NUnit. But the reasons given don't ever seem to be overwhelming or compelling, at least to our situation. (NUnit is updated more often, NUnit is faster, NUnit doesn't require TFS, etc.)

I can use NUnit if I choose, but the use of open source software without a formal support behind it has to be defended. I need a fairly compelling reason to do so.

What I basically have to answer to justify using NUnit in preference to MSTest is this: is there anything that I can do in NUnit that I can't do with comparable effort in MSTest?

like image 526
Dave Hanna Avatar asked Sep 28 '09 15:09

Dave Hanna


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.

Which is better xUnit or NUnit or MSTest?

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.

Is MSTest a unit-testing framework?

The MSTest framework supports unit testing in Visual Studio. Use the classes and members in the Microsoft. VisualStudio.

What is MSTest used for?

MSTest is Microsoft's tool used to run tests of . NET applications (in particular, it can be used for unit testing). In TestComplete, you can integrate your MSTest tests to your test projects and run them as part of your automated testing process.

What is MSTest in NUnit?

MsTest is a framework through which developers can run unit tests for .NET applications. It provides advantages in both speed and robustness when compared to NUnit. Should I use NUnit or xUnit?

Does NUnit support Parameterized Tests?

NUnit is one of the widely used C# test frameworks for cross browser testing as it is compatible with the Selenium test suite. NUnit supports parameterized tests since the release of NUnit 2.5. Test methods can have parameters, and various attributes are available that indicate what arguments should be supplied by the NUnit framework.

Is it possible to execute tests serially in NUnit framework?

The attributes [Test] and [TestCase] are not extensible as those attributes are sealed. Using NUnit framework, tests can be executed serially as well as parallel.

What is the difference between NUnit&MSTest framework?

xUnit starts a new instance per test, whereas, in NUnit & MSTest frameworks, all the tests execute in the same Fixture/Class. 4. Assertion mechanism


1 Answers

  • NUnit contains a [TestCase] attribute that allows implementing parametrized tests. This does not exist out of the box in MSTest - it can be done via extensibility though.
  • MsTest's ExpectedException attribute has a bug where the expected message is never really asserted even if it's wrong - the test will pass.
  • NUnit ships with an Assert.Throws API to allow testing an exception on a specific line of code instead of the whole method. A similar feature exists for MSTest (implemented by the same person who did it for NUnit) but does not ship with MSTest.
  • NUnit contains a fluent version of Assert API out of the box. MSTest has third party extensions that do this, but none are shipped with MSTest.
  • NUnit allows abstract classes to be test fixtures (so you can inherit test fixtures). MsTest allows this but limits abstract classes to a single assembly.
  • NUnit allows non public classes to be test fixtures (as of the latest version)
  • NUnit was created SOLELY for the idea of unit testing. MSTest was created for Testing - and also a bit of unit testing.
  • NUnit contains PNunit (running parallel tests with NUnit). MSTest added this ability in Visual Studio 2010 which is configurable via XML
like image 104
RoyOsherove Avatar answered Sep 22 '22 17:09

RoyOsherove