introduction to tdd

7
Introduction to Test-Driven Development Holger Schmeisky

Upload: holsky

Post on 07-Aug-2015

119 views

Category:

Software


0 download

TRANSCRIPT

Introduction to Test-Driven Development

Holger Schmeisky

Definition

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

(Pair discussion)

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]:

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

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]

Definition

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?