59. TTD and BDD – What Are The Key Differences? FREE CHEAT SHEET // Grab your FREE TDD vs BDD Cheat Sheet: http://bit.ly/2lvse8U
→ SUBSCRIBE for a NEW EPISODE every WEDNESDAY: http://www.DevelopmentThatPays.com/-/subscribe
When I try to start a motorbike, that’s an example of a System Test. And a Blackbox Test. It’s also an example of a Behavioural Test: it’s a test of a behaviour that an end user cases about.
If the motorbike doesn’t start, I might check for a spark. That’s an example of a Functional Test. It tests a collection of components working together.
And if there’s no spark? Perhaps there’s a problem with the spark plug. Or the battery. Or the wiring between the two.
To determine the root cause, we need to test each component in isolation. Testing a spark plug in isolation is an example of a UNIT TEST.
Music: 260809 Funky Nurykabe: http://ccmixter.org/files/jlbrock44/29186
TDD vs BDD. Test Driven Development vs Behaviour Driven Development If you’re looking to a great – NON-TECHNICAL introduction – you’ve come to the right place. Kickstart —— This is the motorbike I owned as a teenager. Same model anyway. This one looks new. Mine was very, very secondhand. It wasn’t the most reliable machine. I had one key test that I’d do every time I came to ride it. I’d try to start it. I’d then go on to test… Nothing. Nothing at all. Of course not! UNLESS, of course, it didn’t start. Then I’d do other tests. It became second nature for me to pull off the plug cap, unscrew the spark plug, push to back into the plug cap, and jump on the kick started to check that I was getting a spark. If the spark didn’t look very healthy, I might check the spark plug gap. Unit Test ——— Checking the spark plug gap is a great example of a UNIT TEST. It’s a test of individual component of a complex system. Importantly, it’s a test of that individual component in ISOLATION. (After all, the gap doesn’t depend on anything else.) Blackbox Test ————- Compare that with the test of “starting the engine”. Starting the engine is a great example of a Blackbox Test. I don’t have to unscrew anything to perform the test. Indeed, I don’t have to know anything about the inner working of the motorbike to perform it. All I need to know are the inputs to supply… fuel on neutral gear little bit of throttle operate the kick starter ..and the output to look out for: the sound of the engine running. It’s a particular kind of blackbox test: it’s a direct test of a BEHAVIOUR that any end user would expect of their motorbike. (The behaviour being: “a running engine”.) It’s a BEHAVIOURAL test. Functional Test ————— What about the other test I mentioned: pull off the plug cap the plug cap, unscrew the spark plug, push to back into the plug cap, and jump on the kick started to check that I was getting a spark. It’s neither a Unit Test, nor is it a Behavioural Test. It sits – somewhat uncomfortably – between the two. It’s an example of a Functional Test: the expected “function” being the production of a spark. A function, by the way, that depends on a whole host of components working in concert: the battery, the spark plug and all the electrical components in between. As a test type, it’s slightly unsatisfactory: A pass doesn’t guarantee that the engine will start. We’d need a behavioural test for that A |fail doesn’t indicate the root cause of the problem. We’d need a SERIES of unit tests do that. Those are reasons enough, I think, to eliminate functional testing from our enquiries. Leaving us – rather conveniently – with the very building blocks of Behaviour Driven Development and Test Driven Development. We’ll go deep on the latter in the very next episode.