Top Banner
Essential TDD Bala Paranj www.rubyplus.com
27
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: Essential tdd lesson-brief-intro-tdd

Essential TDDBala Paranj

www.rubyplus.com

Page 2: Essential tdd lesson-brief-intro-tdd

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?

Page 3: Essential tdd lesson-brief-intro-tdd

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?

Page 4: Essential tdd lesson-brief-intro-tdd

1. What is TDD?

Page 5: Essential tdd lesson-brief-intro-tdd

2. Why TDD?

Page 6: Essential tdd lesson-brief-intro-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.

Page 7: Essential tdd lesson-brief-intro-tdd

Learning

Page 8: Essential tdd lesson-brief-intro-tdd

Better Solution

Page 9: Essential tdd lesson-brief-intro-tdd

3. What are the steps in TDD?

Page 10: Essential tdd lesson-brief-intro-tdd

Step 1Quickly add a test

Page 11: Essential tdd lesson-brief-intro-tdd

Step 2Run all tests and see the new one fail

Page 12: Essential tdd lesson-brief-intro-tdd

Step 3Make a little change to pass

the test as quickly as possible.

Page 13: Essential tdd lesson-brief-intro-tdd

Step 4Run all tests and see them all succeed

Page 14: Essential tdd lesson-brief-intro-tdd

Step 5Refactor to remove duplication

Page 15: Essential tdd lesson-brief-intro-tdd

4. Why start with a failing test

Page 16: Essential tdd lesson-brief-intro-tdd

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?

Page 17: Essential tdd lesson-brief-intro-tdd

6. Minimal Implementation

Page 18: Essential tdd lesson-brief-intro-tdd

Refactor

Page 19: Essential tdd lesson-brief-intro-tdd

Constrain

Page 20: Essential tdd lesson-brief-intro-tdd

7. How TDD Separates What from How

Page 21: Essential tdd lesson-brief-intro-tdd

API - WHAT

Page 22: Essential tdd lesson-brief-intro-tdd

Internal Design - HOW

Page 23: Essential tdd lesson-brief-intro-tdd

8. How to get all Benefits of TDD

Page 24: Essential tdd lesson-brief-intro-tdd

Discipline

Page 25: Essential tdd lesson-brief-intro-tdd

–Kent Beck

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

Page 26: Essential tdd lesson-brief-intro-tdd

9. What makes TDD difficult

Page 27: Essential tdd lesson-brief-intro-tdd

Summary