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.

Test Driven Development SpeedRun

323 views

Published on

"Test Driven Development SpeedRun"
In this talk we will introduce you to Test Driven Development and its main advantages. We will do so by guiding you through a practical exercise being solved with a TDD workflow. We will see how TDD favors better software design and flexibility (with the awesome side effect of test coverage).

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Test Driven Development SpeedRun

  1. 1. Test Driven Development Erinda Jaupaj @ErindaJaupi Valentina Servile @EsseValentina goes to
  2. 2. Introduction What is Test Driven Development?
  3. 3. Introduction What is Test Driven Development?
  4. 4. Introduction What is Test Driven Development? Maybe we should first ask ourselves...
  5. 5. Introduction What is Test Driven Development? What is a Test?
  6. 6. Introduction: what is a test? A test is an assertion about how your code should work
  7. 7. Introduction: what is a test? It’s automated
  8. 8. Introduction: what is a test? It has a binary output (It’s either passing or failing)
  9. 9. Introduction: what is a test? It begins with a precondition (setup)
  10. 10. Introduction: what is a test? It invokes a unit of work in the system (trigger)
  11. 11. Introduction: what is a test? It makes an assertion about the result
  12. 12. Setting up the precondition Invoking the desired behavior Asserting about what happened
  13. 13. Patterns Back to our main topic...
  14. 14. Introduction What is Test Driven Development?
  15. 15. Introduction What is Test Driven Development? It’s a technique where you let tests guide your development workflow
  16. 16. Introduction: how do I TDD? It works in 3 steps:
  17. 17. Introduction: how do I TDD? It works in 3 steps: • Write a failing test
  18. 18. Introduction: how do I TDD? It works in 3 steps: • Write a failing test • Write just enough code to make it pass
  19. 19. Introduction: how do I TDD? It works in 3 steps: • Write a failing test • Write just enough code to make it pass • Refactor your mess
  20. 20. Introduction: how do I TDD? It works in 3 steps: • Write a failing test • Write just enough code to make it pass • Refactor your mess Rinse and Repeat!
  21. 21. Introduction: how do I TDD? REFACTOR FAIL PASS TDD
  22. 22. Introduction What a waste Of time!!! Just make it work!!!
  23. 23. Patterns TDD Hands on
  24. 24. TDD Hands on The requirements: • Print numbers in sequence • If the number is divisible by 3, print “Fizz” • If the number is divisible by 5, print “Buzz” • If divisible by both, print “FizzBuzz”
  25. 25. Patterns The FizzBuzz Kata
  26. 26. Patterns Ta-Da!
  27. 27. Wrapping up: what is TDD for? Okay, so what?
  28. 28. Wrapping up: what is TDD for? But...
  29. 29. Wrapping up: what is TDD for? ...Design! You HAVE to think of the edge cases
  30. 30. Wrapping up: what is TDD for? ...Design! It often leads you to a simpler solution
  31. 31. Wrapping up: what is TDD for? ...Design! Makes you write pretty object interfaces
  32. 32. Wrapping up: what is TDD for? ...Design! You HAVE to think OO. And keep it simple.
  33. 33. Wrapping up: what is TDD for? ...Design! It’s easy to add new features!
  34. 34. Wrapping up: what is TDD for? ...also, tests ...and to check if you broke the old ones
  35. 35. Wrapping up: what is TDD for? ...also, tests ...I’ll write my tests after.
  36. 36. Wrapping up: what is TDD for? ...also, tests The code is self documented
  37. 37. TDD vs Traditional
  38. 38. Wrapping up: when NOT to use TDD? • The application has little to no business logic (CRUD?) • You are building a prototype • Quality is not important
  39. 39. Wrapping up: when to use TDD? • The application has complicated business logic • You don’t know how your implementation will look like • Correctness is crucial • The project is gonna be long lived and frequently retouched
  40. 40. Patterns Give it a try!
  41. 41. www.xpeppers.com /xpepperssrl@xpeppers Thanks! Any questions?
  42. 42. Resources: • http://www.jamesshore.com/Agile-Book/test_driven_d evelopment.html • https://www.amazon.com/Test-Driven-Development- Kent-Beck/dp/0321146530 • http://codingdojo.org/kata/

×