0

I'd like to start using unit testing as part of my development projects. Can anyone recommend any web resources to help explain how to write effective unit tests? A walk through example project would be useful.

I am predominantly working wit C# and would prefer examples which demonstrate using .Net unit testing tools but don't mind if there is a useful example in some other language.

Dunc
  • 7,688
  • 10
  • 31
  • 38

4 Answers4

1

The best one I know http://xunitpatterns.com/

Rafael Oltra
  • 1,239
  • 9
  • 15
  • not actually an answer to your question but..there's also this great guide by Misko Hevery on how to write/refactor code to make it more testable (focused on unit testing) http://misko.hevery.com/code-reviewers-guide/ – Rafael Oltra Jan 14 '11 at 18:34
0

Personally I like the Visual Studio Embedded Test. But in the near past I was really happy with NUnit. If you need some mocking, i would suggest MoQ for his simplicity. Hope this help.

Felice Pollano
  • 32,832
  • 9
  • 75
  • 115
0

Good unit test should make…

  • Easy to write tests

  • Easy to organize your tests

  • Easy to run tests (all, some, one)

I also firstly had experience with NUnit and later moved to MSTest. In my opinion MSTest has 2 strength: it is much easy to create unit test for particular method and run test. The only problem with organising tests in group - that is what was easy to do with NUnit.

More information regarding creating effective unit test for .Net also described here

apros
  • 2,848
  • 3
  • 27
  • 31
0

I very recomment the Art of Unit Testing book from Roy Osherove. This book is an essense of expirience and best practices. And yes, this is not an web-resource, but you should look to Roy's blog too.

Restuta
  • 5,855
  • 33
  • 44