1 / 13

Test Driven Development

Test Driven Development. Daniel Brown. dxb17u. Introduction. Software Development Technique. Based on Unit Testing. Proposed by Kent Beck in 2003. Originates from Extreme Programming (XP). Test Driven Development (TDD) is a feature of XP. Main goal is to produce “clean code that

signa
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 Daniel Brown dxb17u

  2. Introduction • Software Development Technique • Based on Unit Testing • Proposed by Kent Beck in 2003. • Originates from Extreme Programming (XP) • Test Driven Development (TDD) is a feature • of XP • Main goal is to produce “clean code that • works” (Kent Beck)

  3. What is TDD? • TDD has only two simple rules: 1. Write code only if a test has failed 2. Eliminate Duplication at each stage • These two rules imply an order to the • tasks of programming.

  4. TDD Cycle Write a test that fails Write code to pass the test Fail Ensure code passes test Pass Refactor • Process is commonly described as the red/green/refactor programming mantra

  5. Refactoring • “Process of improving the design of code • without changing its behaviour”. • Used to eliminate duplication in TDD. • Other goals include: • Improving extensibility • Improving performance • Changing code to adhere to coding • standards

  6. Direct Implications • Reduces defect density of the code • Programmers become more focused on • system requirements. • Unit Tests can become part of the system • documentation. • Increases developer understanding of • parts of the system.

  7. TDD and XP Values • TDD development helps to support the main values of XP. 1. Communication 2. Feedback 3. Simplicity 4. Courage • Particularly relevant to agile development • methodologies.

  8. Communication • Improves Customer-Developer Communication • More likely to involve customer in • development • Improves Developer-Developer communication • Unit tests proved a means to understand • code • Collective Code ownership

  9. Feedback • TDD maximises system feedback and customer feedback. • Constant unit testing • Short iterations through TDD cycle • Regular system releases to customer. • Developers can respond to customer • feedback efficiently.

  10. Simplicity • Each function is implemented one by one • Reduces scope creep • Customer has more control over the • system being developed

  11. Courage • Keeps developers focused on • implementing the current requirement • Eliminates developer “fear” • Beck states that fear has a number of • negative effects.

  12. Drawbacks • Unit tests which repeatedly failed. • Large number of tests = maintenance • overhead. • Tests are commonly written by the • developer. • Vast number of tests passing may bring a • false sense of security.

  13. Questions?

More Related