1 / 13

Test Driven Development

Test Driven Development. Peter Gordon. Development Approaches. Ad hoc development Writing pseudo code first Model Driven Development (MDD) Test Driven Development (TDD). What is Test Driven Development. TDD = Test First Development + Refactoring. What is Test First Development?.

oistin
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 Peter Gordon

  2. Development Approaches • Ad hoc development • Writing pseudo code first • Model Driven Development (MDD) • Test Driven Development (TDD)

  3. What is Test Driven Development • TDD = Test First Development + Refactoring

  4. What is Test First Development?

  5. What is Refactoring • Refactoring is a disciplined technique for restructuring an existing body of code, altering its internal structure without changing its external behaviour. • A series of small behaviour preserving transformations. • A sequence of transformations can produce a significant restructuring. • Since each refactoring is small, it's less likely to go wrong. • The system is kept fully working after each small step, reducing the chances that a system can get seriously broken during the restructuring.

  6. A list of Refactorings • Decompose Conditional • Duplicate Observed Data • Encapsulate Collection • Encapsulate Downcast • Encapsulate Field • Extract Class • Extract Interface • Extract Method • Extract Package by Gerard M. Davison • Extract Subclass • Extract Superclass • Add Parameter • Change Bidirectional Association to Unidirectional • Change Reference to Value • Change Unidirectional Association to Bidirectional • Change Value to Reference • Collapse Hierarchy • Consolidate Conditional Expression • Consolidate Duplicate Conditional Fragments • Convert Dynamic to Static Construction by Gerard M. Davison • Convert Static to Dynamic Construction by Gerard M. Davison • Form Template Method • Hide Delegate

  7. Test Driven Development • TDD = Test First Development + Refactoring • But what are the advantages?

  8. What are the advantages of TDD? • TDD shortens the programming feedback loop • TDD provides detailed specification (tests) • TDD promotes the development of high-quality code • TDD provides concrete evidence that your software works

  9. What are the advantages of TDD • TDD “speaks” to programmers • TDD provides very finely grained concrete feedback on the order of minutes • TDD helps to ensure that your design is clean by focusing on creation of operations that are callable and testable • TDD supports evolutionary development.

  10. Example in Excel • Integer to Roman in Excel • 1 to I • 2 to II • 3 to III • 4 to IV • … Available online http://www.clarkeching.com/2006/04/test_driven_dev.html

  11. What have we shown • We can develop software in small safe steps, that’s the essence of TDD • TDD can be used to drive software development and lets design emerge • TDD ensures effective unit testing • Resulting tests verify code and act as documentation

  12. TDD lessons learned • Effective technique for developing in all tiers • Flex (Actionscript) - Flexunit • Java - JUnit • PL/SQL – OUnit • Have to develop supporting techniques to make TDD work for you • Create Mock objects and views • Substitute visual elements during testing

  13. TDD lessons learned • User Interface testing is the hardest • More code has to be written using TDD but that isn’t the bottleneck in Software Development • Techniques have to be learned by developers and enforced by managers • Resulting unit tests most valuable when run as part of an automated build process

More Related