Re: Three Law of TDD - to strictly follow, or not?
"Michal Svoboda [email protected] [testdrivendevelopment]" <[email protected]> Tue, 26 Aug 2014 20:33:21 +0200
| Newsgroups | gmane.comp.programming.test-driven-development |
|---|---|
| Message-ID | <[email protected]> |
Kaleb Pederson [email protected] [testdrivendevelopment] wrote: > Do you strictly follow the three laws of TDD as literally written? > What step size do you typically have when going back and forth between > tests and code? How do you decide the appropriate step size? Either approach you described can be justified. Test that just contains one variable is actually complete and says "the object can be constructed this way". Remember there is an implied "this does not fail" even if there are no asserts. In the classic cycle, you would then proceed to write another test, that tells a different story. Then, in the refactor phase, you'd maybe remove the first test. From my experience indeed sometimes you want to go so slow that this is useful. Other times not. In absence of gut feeling, do baby steps. Also, in non-strict typed languages (i.e. javascript) a test that just describes object construction syntax could be useful. > Do you consider, "an incomplete but green test is at best misleading > and at worst wrong"? A test is only wrong in case you have never seen it fail. All other tests are complete and functional. As for misleading, that depends how good a story the test tells. Tests can lie or drift apart from reality. Usually that is more likely when the test uses mocks. Michal ------------------------------------ Posted by: Michal Svoboda <[email protected]> ------------------------------------