🔗 Test-Driven Development Guided by ZOMBIES

Test-Driven Development Guided by ZOMBIES | Agile Alliance The acronym stands for: Z – Zero O – One M – Many (or More complex) B – Boundary Behaviors I – Interface definition E – Exercise Exceptional behavior S – Simple Scenarios, Simple Solutions

15 March 2024 · 1 min · 43 words

📺 Transformation Priority Premise

Uncle Bob Martin walks through the “Prime Factors” kata in Java (29m06s) to illustrate the concept of Transformation Priority Premise as a way to address the common complaint about TDD: the brainlessness “As the tests get more specific, the code gets more generic.” … and “here’s the list of transformations” (47m53s): So what are these transformations? Perhaps we can make a list of them: ({}–>nil) no code at all->code that employs nil (nil->constant) (constant->constant+) a simple constant to a more complex constant (constant->scalar) replacing a constant with a variable or an argument (statement->statements) adding more unconditional statements. (unconditional->if) splitting the execution path (scalar->array) (array->container) (statement->recursion) (if->while) (expression->function) replacing an expression with a function or algorithm (variable->assignment) replacing the value of a variable. There are likely others. ...

18 March 2014 · 1 min · 199 words

📜 First make it work (get tests to pass)

First make it work (get tests to pass). Then make it right (clean it). Then make it fast. (if it needs it). Uncle Bob (via How to convince ‘performance guys’ to Clean Code – Google Groups )

3 December 2013 · 1 min · 37 words

🔗 Mocks Aren’t Stubs

Mocks Aren’t Stubs Meszaros uses the term Test Double as the generic term for any kind of pretend object used in place of a real object for testing purposes. The name comes from the notion of a Stunt Double in movies. (…) Meszaros then defined four particular kinds of double: Dummy objects are passed around but never actually used. Usually they are just used to fill parameter lists. Fake objects actually have working implementations, but usually take some shortcut which makes them not suitable for production (an in memory database is a good example). Stubs provide canned answers to calls made during the test, usually not responding at all to anything outside what’s programmed in for the test. Stubs may also record information about calls, such as an email gateway stub that remembers the messages it ‘sent’, or maybe only how many messages it ‘sent’. Mocks are what we are talking about here: objects pre-programmed with expectations which form a specification of the calls they are expected to receive. The classical TDD style is to use real objects if possible and a double if it’s awkward to use the real thing. So a classical TDDer would use a real warehouse and a double for the mail service. The kind of double doesn’t really matter that much. ...

24 October 2013 · 2 min · 243 words