-6

We are building a new product and we are in phase 0. I was given a task to decide which unit testing tool should be used. I have worked with Rhino mocks, NuNit and testdriven.net in the past and I liked all of them.

I would like to know their pros and cons which could help me in deciding which one to choose.

halfer
  • 19,824
  • 17
  • 99
  • 186
alice7
  • 3,834
  • 14
  • 64
  • 93
  • 3
    please be more specific about what you actually need in your project. – Efrain Nov 16 '11 at 16:33
  • I will suggest you to expose your application to an extent you can, then only one can suggest you a appropriate testing tool – Sandy Nov 16 '11 at 16:39

4 Answers4

5

You have mentioned Rhino Mocks, NUnit and TestDriven. I would not compare these against one another. However you can compare each of these with its counterparts.

Here is a start! - I tried to include links for comparisons

Unit testing Frameworks

  • NUnit
  • MsTest
  • MBUnit
  • xUnit

NUnit vs. MbUnit vs. MSTest vs. xUnit.net

I slightly prefer NUnit, seems to be one of the most used, and it's extremely easy to use. But I would not mind the others.

Style of testing

I guess this would effect my testing choice the most. Unit testing can be done using AAA (Arrange Action Assert) or BDD (Behaviour Driven Development).

I find BDD is really helpful with Domain Driven Design, as it tests the uses stories and puts the domain as a subject under test.

For AAA you can just use the Unit Frameworks.

BDD Frameworks

Tdd vs Bdd (compare of the approach) http://lostechies.com/seanchambers/2008/12/07/starting-with-bdd-vs-starting-with-tdd/

Mocks

Look for a syntax you like for setting up mocks. There are so many in the .NET space.

  • Rhino Mocks
  • Moq
  • NMock
  • TypeMock (use if you want to mock out concrete types, but not free)

https://stackoverflow.com/questions/37359/what-c-sharp-mocking-framework-to-use

VS plugins

Again, whatever makes you feel better

  • TestDriven.NET
  • ReSharper - I like this (use with PartCover)
  • VS (test window)

Code Coverage

You did not mention this, however you have to be able to justify code which is written.

http://geekswithblogs.net/thomasweller/archive/2010/07/16/dotcover---a-new-kid-on-the-development-block.aspx

Edit

Testing Web Services

Database Testing

  • Sqlite - if you are using an orm (NHibernate for example), as the sql can slightly change from your sql vendor
  • NDbUnit - if your are using SP's, ORM or hand cranked SQL

Hope this helps

Community
  • 1
  • 1
dbones
  • 4,415
  • 3
  • 36
  • 52
1

Since all unit-testing frameworks (at least the ones I know) are based on very similar principles, I think which one to use is mainly a matter of taste. Here's a table comparing the usage details of various common frameworks in the .net world.

If you want to employ more of a BDD style, I'd recommend looking at SpecFlow or Machine.Specifications (MSpec). Though both require a xUnit-based unit-testing framework underneath.

As a test runner I use testdriven.net myself, but this is a matter of taste as well. If you're using something like ReSharper or DevExpress CodeRush (you use such a tool, right?) you can use their test runners respectively. (Even though I personally don't like DevExpress' test runner at all.)

The same goes with the mocking framework. Use what you're comfortable with.

Dennis Traub
  • 50,557
  • 7
  • 93
  • 108
0

http://en.wikipedia.org/wiki/List_of_unit_testing_frameworks

gmhk
  • 15,598
  • 27
  • 89
  • 112
0

Here you have a mocking frameworks comparaison that might help you to chose another one :

https://stackoverflow.com/questions/37359/what-c-sharp-mocking-framework-to-use

Community
  • 1
  • 1
Tomasz Jaskuλa
  • 15,723
  • 5
  • 46
  • 73