1 / 9

Test-Driven Development

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 ?”. Introduction.

kswan
Télécharger la présentation

Test-Driven Development

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Test-Driven Development

  2. 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?”

  3. 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

  4. 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

  5. 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

  6. 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

  7. 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!

  8. 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 • Extremely simple and comfortable

  9. References • Test-Driven Development (Wikipedia) http://en.wikipedia.org/wiki/Test-driven_development • Introduction to Test Driven Design http://www.agiledata.org/essays/tdd.html • Resources for Test Driven Development • http://junit.org/

More Related