Test-Driven !
Development
Debugging sucks!
Testing rocks!
Traditional flow
Design
Implement
Test
Test-driven flow
Design
Implement
Test
Test-driven flow
Design
Implement
Test
Test
Test-driven flow
Design
Implement
TestTest
Test-driven flow
Design
Implement
TestTest
Figure out what you want to do
Test-driven flow
Design
Implement
TestTest
Write a test to express the design 

It should FAIL
Test-driven flow
Design
Implement
TestTest
Write the code
Test-driven flow
Design
Implement
TestTest
Test again 

It should PASS
Add a test
Each new feature begins with writing a
test
Focus on the
requirements before
writing the code
Run all tests
Check that changes are required and test
passes only in intended cases
Write a code
Write simplest and inelegant code to make
test pass
Use hardcodes where
possible
Run tests
Adjust code until it meets the test
requirements
Refactor code
Cleanup your code!
Don’t worry, test covers you
What is TDD?
Red RefactorGreen
1. Write tests!
2. Implement changes!
3. Cleanup code
Bug fixing
1. Find bad code !
2. Turn it into a test !
3. Test should fail !
4. Fix bug !
5. Test should now pass
Advantages of TDD
Advantages of TDD
No more repeat bugs 







Advantages of TDD
No more repeat bugs 

Better design 





Advantages of TDD
No more repeat bugs 

Better design 

Quick feedback 



Advantages of TDD
No more repeat bugs 

Better design 

Quick feedback 

Easy refactoring 

Advantages of TDD
No more repeat bugs 

Better design 

Quick feedback 

Easy refactoring 

Great code coverage
YOU!
know !
TDD
Sources
http://www.amazon.com/Art-Unit-Testing-Examples-Net/dp/1933988274!
http://www.amazon.com/Test-Driven-iOS-Development-Developers-Library/dp/0321774183 !
http://www.objc.io/issue-1/testing-view-controllers.html!
http://qualitycoding.org/benefit-of-tdd/#more-2618!
Live Coding
https://github.com/maksumko/TDD-iOS-Demo

Test Driven Development