Test Driven Development at 10,000 Feet

17
TEST DRIVEN DEVELOPMENT Let’s begin At 10,000 feet

description

An introduction to Test Driven Development for those not familiar with it.

Transcript of Test Driven Development at 10,000 Feet

Page 1: Test Driven Development at 10,000 Feet

TEST DRIVEN DEVELOPMENT

Let’s begin →Let’s begin →

At 10,000 feet

Page 2: Test Driven Development at 10,000 Feet

WHY TDD?

• We need a way to find defects earlier on in the development cycle..

Page 3: Test Driven Development at 10,000 Feet

TDD REDUCES DEBUG TIME

Page 4: Test Driven Development at 10,000 Feet

TESTS = CODE EXAMPLES

Page 5: Test Driven Development at 10,000 Feet

NO TDD = NO VELOCITY• The more complex our code becomes, the longer it takes to make

changes or add new features.C

ompl

exity

Time Easy to change

Hard to change

Page 6: Test Driven Development at 10,000 Feet

TDD PROTECTS US FROM OURSELVES

• Automated tests remind us when we inadvertently screw up part of the code. No matter how significant.

Page 7: Test Driven Development at 10,000 Feet

TDD EMPOWERS YOU

Page 8: Test Driven Development at 10,000 Feet

THE THREE RULES OF TDD

Page 9: Test Driven Development at 10,000 Feet

RULE # 1

• You are not allowed to write any production code unless it is to make failing unit tests pass.

Page 10: Test Driven Development at 10,000 Feet

RULE #2

• You are not allowed to write any more of a unit test than is sufficient to fail; and compilation failures are failures.

Page 11: Test Driven Development at 10,000 Feet

RULE #3

• You are not allowed to write any more production code than is sufficient to pass the one failing test.

Page 12: Test Driven Development at 10,000 Feet

TDD IN PRACTICE

Page 13: Test Driven Development at 10,000 Feet

SAY WHAT?

Page 14: Test Driven Development at 10,000 Feet

Let’s see some code

Page 15: Test Driven Development at 10,000 Feet

The Bowling Game

1

60

4

5

4 5

14

6 5

29 49

0 1

11761

7 6

77 97

2 6

133

Page 16: Test Driven Development at 10,000 Feet

• Test code is just as important as production code and should be shown the same level of respect and professionalism.

Page 17: Test Driven Development at 10,000 Feet

THANK YOU!Any Questions?