Introduction to Test Driven Development [TDD]

487 views

Published on

This preso introduces the concept of TDD and explains the techniques involved in implementing

Published in: Technology, Business
  • Be the first to comment

Introduction to Test Driven Development [TDD]

  1. 1. TEST DRIVEN DEVELOPMENT [TDD] An Introduction Ashish K Agarwal Vijay S Dey
  2. 2. Takeaways  Understand the TDD philosophy  Oriented towards TDD practice  Aware of techniques for TDD  Write use case driven unit tests
  3. 3. Contents  Why TDD  Three laws of TDD  Professional attitude towards TDD  Conventions for well written tests  Tools for TDD  Common TDD mistakes
  4. 4. Why TDD?  It helps clarify business requirements  Allows to identify bug ahead of time  Develops the system incrementally  Gains confidence in our own code  Helps maintain the code
  5. 5. Three laws of TDD
  6. 6. Professional attitude towards TDD  Think about the tests first  Break the problem into smaller units  Treat the test code on par with production code  Have tests as documentation of the actual code  “Be Nice” to fellow developers
  7. 7. Conventions for well written tests  Name of test – should indicate the business intent so when the test fails, dev knows why it matters E.g. testHappyPath() ShouldAlertUserWhenInputIsEmpty()
  8. 8. Conventions (cont’d)  Skeleton of test – Setup -> Execute -> Verify E.g.
  9. 9. Conventions (cont’d)
  10. 10. Conventions (cont’d)
  11. 11. Tools for TDD  Junit framework  Mockito  Test code coverage – e.g. Clover
  12. 12. Hands on Calculator Service
  13. 13. Takeaways  Understand the TDD philosophy  Oriented towards TDD practice  Aware of techniques for TDD  Write use case driven unit tests

×