I have never been entirely sure what to put in unit tests and most references I have seen use really contrived examples like a calculator. Does anyone know of a good example of a test suite written for a small database-backed webapp? (Ideally, one that uses Tapestry 5 or Seam, but I’ll take what I can get.)
Also, regarding TDD, I have never been really clear on how much to write before testing. The examples I have seen were so fine-grained as to be an impediment to productivity. I can write a class that has just enough code to pass a test but it seems like you wind up going through too many iterations between the test and the code. Does anyone know of any decent examples of this?
Thanks,
Rob