Being able to write and setup new tests quickly is cruical in doing unit testing at all. If you can't write a new testcase in say 2 minutes (new class; extends TestCase; public void testBla()...) you are not going to do it. JUnit is lean enough to write test quickly but is the code you'll be testing? Mostly not. And this is where you end up in a circle. You don't write tests for your code because it is too complicated to setup the test and it take to long to do so. And because you don't have test you are likely going to break your code when refactoring it. But if you can't (or you don't have the courage to do so :-) refactor it your class will have all these dependencies to other classes which make it impossible to test it.
Welcome to code hell.
Dienstag, 18. September 2007
Abonnieren
Posts (Atom)