Re: Three Law of TDD - to strictly follow, or not?
"Kevin Rutherford [email protected] [testdrivendevelopment]" <[email protected]> Tue, 26 Aug 2014 18:05:31 +0100
| Newsgroups | gmane.comp.programming.test-driven-development |
|---|---|
| Message-ID | <CAGhP06nC40kdUJ8JiroDyi+o82anrTgSdN+NtiPbivLNuP1ztw@mail.gmail.com> |
Hi Kaleb, On Tue, Aug 26, 2014 at 4:48 PM, Kaleb Pederson [email protected] [testdrivendevelopment] <[email protected]> wrote: > [...] > Coworker 2 recently came to me with some questions. He described his process wherein he would: > > * Create an empty test > * Add a variable assignment: var instance = new MyClass(); Stop! Go back to where you had the empty test. Now, write the assert that matches the intent of the test. It (probably) won't compile, but at least you have the assert, and that's what drives everything else. Now fill in enough details so that the test compiles, etc. In general, if you think of a test as Arrange / Act / Assert, work backwards: Assert first, then Act, then Arrange. This is the TDD process in action /within/ the test. Cheers, Kevin -- http://xpsurgery.com -- remote one-to-one tutoring in TDD and OO http://kevinrutherford.co.uk -- software development coaching http://refactoringinruby.info -- Refactoring in Ruby, the book ------------------------------------ Posted by: Kevin Rutherford <[email protected]> ------------------------------------