Presentation on theme: "Test-Driven Development. Why Testing is Important? “If you don’t have tests, how do you know your code is doing the thing right and doing the right thing?”"— Presentation transcript:
Why Testing is Important? “If you don’t have tests, how do you know your code is doing the thing right and doing the right thing?”
Introduction Test-Driven Development (TDD) is a software development technique that involves repeatedly first writing a test case and then implementing only the code necessary to pass the test The technique began to receive publicity in the early 2000s as an aspect of Extreme Programming A method of designing software, not merely a method of testing
Requirements Test-driven development requires that an automated unit test, defining requirements of the code, is written before each aspect of the code itself Purpose is to check that component (unit, class, method) contract is satisfied Having good test coverage is extremely important, especially in a large systems
The Promise of TDD The promise of TDD is that it helps you go faster with fewer defects and with less baggage to carry around. These benefits are evident through the following characteristics of the process: No untested code Focus on requirements No code creep Improved design Small steps
Test-Driven Development Cycle Add a test Run all tests and see the new one fail Write some code Run the automated tests and see them succeed Refactor code
Benefits For developers: Much less debug time Code proven to meet requirements Tests become Safety Net Eliminate Bug Pong Rhythm of Success For business: Shorter development cycles Near zero defects Tests become an asset Tests are documentation Competitive advantage!
Unit-Testing Frameworks Various code-driven testing frameworks have come to be known collectively as xUnit The de facto Java unit testing framework is JUnit However, other also exists, e.g. TestNG Extremely simple and comfortable!
References Test-Driven Development (Wikipedia) driven_development driven_development Introduction to Test Driven Design JUnit Resources for Test Driven Development