On Tue, Apr 20, 2010 at 09:18:36AM +1000, Patrick Barnes wrote: > That does seem to be the way to go about implementing such a system. > I will see how I go, and will publish the results if I end up with > something that seems reusable.
It's probably worth noting that by interfacing with the database you technically aren't unit testing - it's closer to integration testing. Unit tests are supposed to test discrete units, and shouldn't rely on (for example) a database connection. Yes, this is a bit purist, and no, mocking a database is not always realistic when time constraints are involved. I know that I didn't want to mock CouchDB when writing unit tests for Sag (would've been its own project): http://github.com/ravidgemole/sag/tree/master/tests/. If anyone is up for mocking CouchDB, then I'm all ears - has this been done in any other languages yet? Cheers, -- Sam Bisbee
