essential tdd lesson-brief-intro-tdd

27
Essential TDD Bala Paranj www.rubyplus.com

Upload: bala-paranj

Post on 15-Jul-2015

179 views

Category:

Software


0 download

TRANSCRIPT

Essential TDDBala Paranj

www.rubyplus.com

Outline1. What is TDD?

2. Why TDD?

3. What are the steps in TDD?

4. Why start with a failing test?

5. How to write a failing test?

Outline

6. Why be minimal?!

7. How TDD separates the What from How?

8. How to get all benefits of TDD?

9. What makes TDD difficult?

1. What is TDD?

2. Why TDD?

–Kent Beck

Clean code that works gives you a chance to learn all the lessons that the code has to teach you. If you only

slap together the first thing you think of, you never have time to think of a second, better thing.

Learning

Better Solution

3. What are the steps in TDD?

Step 1Quickly add a test

Step 2Run all tests and see the new one fail

Step 3Make a little change to pass

the test as quickly as possible.

Step 4Run all tests and see them all succeed

Step 5Refactor to remove duplication

4. Why start with a failing test

5. How to write a failing test• What is our System Under Test’s (SUT)

responsibility?

• What should it do?

• What is the API for making the SUT do this?

• What does the SUT need to fulfill its responsibility?

• What output are there to observe?

• How can we tell it worked correctly?

6. Minimal Implementation

Refactor

Constrain

7. How TDD Separates What from How

API - WHAT

Internal Design - HOW

8. How to get all Benefits of TDD

Discipline

–Kent Beck

I am not a great programmer. I am just a good programmer with great habits.

9. What makes TDD difficult

Summary