with Draven
TDD RULZ
Coderetreat 2010
TDD RULZ
Coderetreat 2010
HOW ARE U?
We are testers!
JUnit ftw!
After implementation, focus on the implementation & algorithm
After implementation, focus on the implementation & algorithm
Tests first, high-quality code via small and verifiable steps
describe(`peaceMaker()`, () => {
it(`should return Peace
when Love and Humanity are given`, () => {
let result = peaceMaker(`Love`, `Humanity`)
assert.equal(result, `Peace`)
})
});
> Test runner
peaceMaker()
✘ should return Peace
when Love and Humanity are given
Test run completed!
1 out 1 tests failed :(
describe(`peaceMaker()`, () => {
it(`should return Peace
when Love and Humanity are given`, () => {
let result = peaceMaker(`Love`, `Humanity`)
assert.equal(result, `Peace`)
})
});
peaceMaker(a, b) => {
if (a == "Love" && b == "Humanity")
return "Peace"
}
> Test runner
peaceMaker()
✔ should return Peace
when Love and Humanity are given
describe(`peaceMaker()`, () => {
it(`should return Peace
when Love and Humanity are given`, () => {
let result = peaceMaker(`Love`, `Humanity`)
assert.equal(result, `Peace`)
})
});
peaceMaker(componentOfPeace1, componentOfPeace2) =>
if (componentOfPeace1 == "Love" &&
componentOfPeace2 == "Humanity")
return "Peace"
}
> Test runner
peaceMaker()
✔ should return Peace
when Love and Humanity are given
Ensures small steps
Fast feedback
Less bugs
Great coverage & testable code
Living documentation
Design first
Trust
Steep learning curve
Slower
for the first sight
Not for everything
Learning curve
TDD, BLABLA, BLABLA, ...
That's me, Draven!
I'm small
:)
TV
FAKE NEWS
No Time
:(
Make it!
TV
FAKE NEWS
Do a spike!
How to test it?
TV
FAKE NEWS
Pair up!
It's too hard
:(
TV
FAKE NEWS
I have legacy
:(
Make space!
TV
FAKE NEWS
It's UI,
untestable!
Separation of concerns
TV
FAKE NEWS
I am
MOCKIST!
Just
don't
...
TV
FAKE NEWS
Not fun!
???
"Moments to learn,
lifetime to master"