Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Introduction to
Test Driven
Development (TDD)
I am Brendon Body
I am here because I am passionate about programming.
You can find me at www.brendonbody.com or
@DormeoES...
Introduction to
TDD1
History of TDD
◉Test Driven Development is commonly
known as TDD
◉Type of software development methodology
◉Introduced by ...
“
TDD doesn't drive good design.
TDD gives you immediate
feedback about what is likely to be
bad design
- Kent Beck
What is TDD?
◉Write failing test cases before you write the
code
◉Allows tests cases to form the design of the
code before...
Write tests to fail
Your unit tests should be failing until the code is
finished being written
The process is simple
Fail
Write
Code
RepeatPass Refactor
Example of TDD
◉Language: Python 3
◉Aim: Create a program to calculate addition
operations for strings of numbers and
oper...
What is TDD not?2
What is TDD not?
◉A silver bullet for code quality
◉A tool which writes your code/test cases for
you
◉A replacement for sy...
“
The bitterness of poor quality
remains long after the sweetness
of meeting the schedule has been
forgotten
Advantages of TDD3
More advantages of TDD
◉Provides confidence on code that is written
does what it is supposed to
◉Good unit test coverage m...
More Advantages of TDD
◉Forces programmer to think through
problems and potential edge cases early on
◉Can be used as docu...
“
The best TDD can do, is assure
that code does what the
programmer thinks it should do.
That is pretty good BTW
- James G...
Conclusion4
Conclusion
◉Write failing test cases before you write the
code
◉Enforces more strictness in unit test
coverage
◉Easily can...
“
I taught Bethany, my oldest daughter, TDD as
her first programming style when she was
about age 12. She thinks you can’t...
Thank you
◉Thank you for watching
◉If you have any questions or comments
please leave them in the Youtube comment
area
Credits
Special thanks to all the people who made and
released these awesome resources for free:
◉Presentation template by...
Upcoming SlideShare
Loading in …5
×

Introduction to TDD

196 views

Published on

Introduction to Test Driven Development

Published in: Software
  • Be the first to comment

  • Be the first to like this

Introduction to TDD

  1. 1. Introduction to Test Driven Development (TDD)
  2. 2. I am Brendon Body I am here because I am passionate about programming. You can find me at www.brendonbody.com or @DormeoES Hello!
  3. 3. Introduction to TDD1
  4. 4. History of TDD ◉Test Driven Development is commonly known as TDD ◉Type of software development methodology ◉Introduced by Kent Beck of Extreme Programming fame
  5. 5. “ TDD doesn't drive good design. TDD gives you immediate feedback about what is likely to be bad design - Kent Beck
  6. 6. What is TDD? ◉Write failing test cases before you write the code ◉Allows tests cases to form the design of the code before it is written ◉Provides a more strict method for programmers to guarantee their test cases are written ◉Useful for debugging older code
  7. 7. Write tests to fail Your unit tests should be failing until the code is finished being written
  8. 8. The process is simple Fail Write Code RepeatPass Refactor
  9. 9. Example of TDD ◉Language: Python 3 ◉Aim: Create a program to calculate addition operations for strings of numbers and operators. E.g. ‘1+1’ => 2 Note: Assumes input has no problems. ◉Source: https://gist.github.com/bbody/2abb3264477f01215d78
  10. 10. What is TDD not?2
  11. 11. What is TDD not? ◉A silver bullet for code quality ◉A tool which writes your code/test cases for you ◉A replacement for system, integration, user acceptance, etc. testing ◉Necessarily suitable in smaller projects, particularly if client/management doesn’t support writing of test cases
  12. 12. “ The bitterness of poor quality remains long after the sweetness of meeting the schedule has been forgotten
  13. 13. Advantages of TDD3
  14. 14. More advantages of TDD ◉Provides confidence on code that is written does what it is supposed to ◉Good unit test coverage makes refactoring later easier ◉Forces programmers to ensure there are test cases for all features
  15. 15. More Advantages of TDD ◉Forces programmer to think through problems and potential edge cases early on ◉Can be used as documentation for features (if kept up to date) ◉Provides security against code changes ◉Generally produces higher quality code ◉Can easily integrate into existing workflows
  16. 16. “ The best TDD can do, is assure that code does what the programmer thinks it should do. That is pretty good BTW - James Grenning
  17. 17. Conclusion4
  18. 18. Conclusion ◉Write failing test cases before you write the code ◉Enforces more strictness in unit test coverage ◉Easily can integrate into existing workflows ◉Not a silver bullet but can vastly improve development quality
  19. 19. “ I taught Bethany, my oldest daughter, TDD as her first programming style when she was about age 12. She thinks you can’t type in code unless there is a broken test. The rest of us have to muddle through reminding ourselves to write the tests. - Kent Beck
  20. 20. Thank you ◉Thank you for watching ◉If you have any questions or comments please leave them in the Youtube comment area
  21. 21. Credits Special thanks to all the people who made and released these awesome resources for free: ◉Presentation template by SlidesCarnival ◉Photographs by Unsplash

×