Top Banner
Introduction to Test-Driven Development Holger Schmeisky
7
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Introduction to TDD

Introduction to Test-Driven Development

Holger Schmeisky

Page 2: Introduction to TDD

Definition

What do you think it is?How do you develop test-driven?

(Pair discussion)

Page 3: Introduction to TDD

Definition

● Kent Beck popularized the term

as „Test-first development“ in 2000

● "Write a failing automated test before

changing any code."

● (Not more, because "Incremental Design" is a separate XP practice)

● [Extreme Programming 2, Chap.7]:

Page 4: Introduction to TDD

Definition

● Martin Fowler

● „Write a test for the next bit

of functionality you want to add.

● Write the functional code until the

test passes.

● Refactor both new and old code to make it well structured.“

http://martinfowler.com/bliki/TestDrivenDevelopment.html

Page 5: Introduction to TDD

Definition

● Uncle Bob

● "You may not write production code

until you have written a failing unit test.

● You may not write more of a unit test than is sufficient to fail, and not compiling is failing.

● You may not write more production code than is sufficient to pass the currently failing test.

● These three laws lock you into a cycle that

is perhaps thirty seconds long."

[Clean Code, Chapter 9]

Page 6: Introduction to TDD

Definition

Page 7: Introduction to TDD

Advanced Topics (not covered)

● How many unit tests to keep?

● How to maintain suites of unit tests?

● What is the best choice of „unit“? (In more complex problems)

● When can mocking be helpful, when harmful?

● How much should you design for testability?