NUnit Test vs MsTest

Mar 8, 2010 Posted by Lara Kannan
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.

Happy coding!

Source : ISerializable.com

Share
  1. Anonymous

    why are you stealing my content, Lara - without even a link back to the original blog?

    Roy Osherove
    ISerializable.com

  2. Sorry Roy, I forgot it to add the source link. Thanks for your alert.

Post a Comment