Upgrade to Pro — share decks privately, control downloads, hide ads and more …

TDD: A Pragmatic Approach

TDD: A Pragmatic Approach

Unit Testing can be mysterious endeavor with a high bar for entry. It doesn't have to be that complicated. Many examples on the Internet show you how to write a Unit Test, but not how to test an entire application. We'll discuss the fundamentals of TDD, how to approach an entire application, how to separate logical layers, and how to test the boundaries.

John Callaway

June 10, 2016
Tweet

More Decks by John Callaway

Other Decks in Programming

Transcript

  1. John Callaway • Professional developer since 1999 • Specialize in

    web technologies • Primarily with line-of-business • Enjoy learning new tech
  2. What is Test Driven Development Test-driven development (TDD) is a

    software development process that relies on the repetition of a very short development cycle: requirements are turned into very specific test cases, then the software is improved to pass the new tests, only. This is opposed to software development that allows software to be added that isn't proven to meet requirements.
  3. Kent Beck says: Clean code that works – now. This

    is the seeming contradiction that lies behind much of the pain of programming. Test Driven Development replies to this contradiction with a paradox – test the program before you write it.
  4. Show of hands • Who writes at least one test

    a day? • Who writes at least 10 tests a day? • Who writes at least 100 tests a day? • Who will not write a line of production code without a failing test?
  5. Why would we test? • Reduce effort of manual testing

    • Reduce bug count • Ensure some level of correctness • Remove the fear of refactoring
  6. Why don’t we test? • Testing is hard • Testing

    takes time • Testing is expensive • We don’t know how
  7. Never have I ever • Used QA as a debugger

    • Shipped code without verifying it worked • Struggled to reproduce a bug • Cost my company/client money with a defect
  8. Appendix Wiki - https://en.wikipedia.org/wiki/Test-driven_development Kent Beck - https://en.wikiquote.org/wiki/Kent_Beck Code samples

    - https://github.com/ovation22/PragmaticTDD Homework: • Add more to Horse detail page • Add Colors page listing all colors • Add Color detail page listing all horses of selected color