110 likes | 289 Views
Test Driven Development. Presented by: Ryan Rapp. Overview. What is TDD? Refactoring Advantages Disadvantages Why should I use TDD? Conclusions. What is TDD?. Don’t write production code without first writing a failing unit test Don’t write more of a test than is sufficient to fail
E N D
Test Driven Development Presented by: Ryan Rapp
Overview What is TDD? Refactoring Advantages Disadvantages Why should I use TDD? Conclusions
What is TDD? Don’t write production code without first writing a failing unit test Don’t write more of a test than is sufficient to fail Don’t write more code than is sufficient to pass the test
What is a Unit Test? Tests a very small section of code in isolation Runs every time you compile your code Easy to read and understand Runs very quickly May use mock objects to avoid testing complex interactions
Refactoring Take existing code and change it so that it is more efficient Don’t actually change the output of the code, just how it works May incorporate significant changes
Advantages Produces fully testable code Gets running code very quickly Design to the specifications, don’t over-engineer
Disadvantages Causes people to take paths they wouldn’t otherwise “Write test, write code to pass test, repeat” loop is overly strict Most TDD shops don’t strictly adhere to it
Why should I use TDD? TDD makes you produce 100% testable code You won’t spend a long time with non-running code Your code will always meet the design specifications
Conclusion TDD isn’t for everyone TDD is a very good design principle TDD produces 100% tested/testable code End up with better software