views:

79

answers:

4

Can anyone sugggest good references/guides for getting started with nunit and visual studio 2008. (Apart from the Nunit documentation itself!). I specifically want to set up a test project in vs 2008.

A: 

Dimecasts has good, short screencasts covering NUnit The page lists them in reverse order, so start at the bottom and work up!

Dr Herbie
+2  A: 

There's a good book called "Pragmatic Unit Testing with NUnit" by Thompson and Hunt.

That's how I started and it provides a good introduction.

For more information on how and what to test in general I'd recomment "The Art of Unit Testing" by Osherove and "Test Driven Development" by Beck.

Also take a look at this helpful summary card also from Thompson and Hunt

http://media.pragprog.com/titles/utj/StandaloneSummary.pdf.

The concepts are further explained in their book.

Update: Not sure I can recommend any books that describe the mechanics of setting up your project but I can offer some basic advice. Create a separate test project for each source project you want to test. Make sure you don't mix integration/system testing with your unit tests. One way to ensure this is to differentiate between test projects. e.g. I might have something like

  • CustomLibraryCode.proj //source project
  • CustomlibraryCodeTests.Unit.proj //unit test project
  • CustomLibraryCodeTests.Integration.proj //integration test project

This means that your unit tests which should be quick and easy to run can be executed in isolation from the integration tests, which typically might have dependencies on database, filesystem, etc., and tend to be slower and more brittle.

Ben Cawley
+3  A: 

On top of other books mentioned, there is a new good book with loads of examples: Growing Object-Oriented Software, Guided by Tests

Grzenio
Nice one! That's the 'other' book I was desperately trying to remember the name of!
Ben Cawley
+1  A: 

I just got The Art of Unit Testing with Examples in .NET by Roy Osherove. You can get it at Amazon and here is the site: http://artofunittesting.com/. It's pretty easy to understand. The book is written with examples in VS 2008 and Nunit. He also mentions other test frameworks.

B Seven