People are still wondering what are the differences between the two most popular unit testing frameworks in the .NET world: the open source NUnit and the commercial MsTest).
Here’s a short list of what i remember instantly:
- Nunit contains a [TestCase] attribute that allows implementing parametrized tests. this does not exist in msTest
- 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 has an Assert.Throws API to allow testing an exception on a specific line of code instead of the whole method (you can easily implement this one yourself though)
- Nunit contains a fluent version of Assert api (as already mentioned - Assert.That..)
- Nunit is much faster
- NUnit can run tests in 32 and 64 bit (MSTest only runs them in 32 bit IIRC)
- NUnit allows abstract classes to be test fixtures (so you can inherit test fixtures). MsTest does not.
- 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 prallel tests with Nunit). MsTest only adds this ability in vs 2010
given all these – MsTest has much better abilities for integration based testing (all these are things Nunit doesn’t even want to have):
- ability to do data-driven tests from a db data source
- ability to do performance testing
- ability to determine the order of tests (ordered tests)
- ability to easily setup and teardown and generate database data
- great integration with team system reporting for LOADS of statistics
having said all these:
if you’re working with team system, I’d use MsTest. the integration with other team system tools and reporting is just beyond compare and the reporting alone helps alot to find recurring breaking tests, code churn vs. new tests and others.