25
Test Driven Development It’s All about Fluency @LlewellynFalco

Test drivendevelopment fluency

Embed Size (px)

Citation preview

Page 1: Test drivendevelopment   fluency

Test Driven DevelopmentIt’s All about Fluency @LlewellynFalco

Page 2: Test drivendevelopment   fluency

Is Testing Faster? (Test After)

Work (code)

Non-Work(tests)

60 Minutes

X minutes

Code60 Minutes< Code + Test

60 + X minutes

Page 3: Test drivendevelopment   fluency

Is Testing Faster? (Test 1st)

Work (code)

Non-Work(tests)

30 Minutes

X minutes

Code60 Minutes < Test + Code

X + 30 minutes?

Page 4: Test drivendevelopment   fluency

Today’s Kata: Triangle1) A side has a distance2) Side knows endpoints3) 3 points4) 3 sides5) Perimeter6) Get sides touching a point7) Get side opposite a point8) The angle of 2 sides touching a point9) 3 angles10) Right Triangle

Page 5: Test drivendevelopment   fluency
Page 6: Test drivendevelopment   fluency

Parts of a Test

1) Do2) Verify

Page 7: Test drivendevelopment   fluency

Demo

Page 8: Test drivendevelopment   fluency

Benefits of Unit Tests

1) Specification2) Feedback3) Regression4) Granularity

Page 9: Test drivendevelopment   fluency

Regression

If I used to get : Then I still get :

AA

Page 10: Test drivendevelopment   fluency

Intentional Code

// Create a Side from (0,0) to (5,0)

var side = new Side(0,0,5,0);

Page 11: Test drivendevelopment   fluency

Consume 1st

Write the objects & methods you wish existed

Page 12: Test drivendevelopment   fluency

Test Until Bored

Test the cases that bring you value

Page 13: Test drivendevelopment   fluency

VerificationIs it the right answer?1. Change the Question2. Ask an expert

Page 14: Test drivendevelopment   fluency

Completing the CircleYour output should tell the story.Objects should have ToStrings

Benefits1. Specification2. Feedback3. Regression4. Granularity

Page 15: Test drivendevelopment   fluency

Fake it Till You Make ItBuys some timeAllows for Triangulation

Page 16: Test drivendevelopment   fluency

Today’s Kata: Triangle1) A side has a distance2) Side knows endpoints3) 3 points4) 3 sides5) Perimeter6) Get sides touching a point7) Get side opposite a point8) The angle of 2 sides touching a point9) 3 angles10) Right Triangle

Page 17: Test drivendevelopment   fluency

Verifying MultiplesVerify Single:Approvals.Approve(result);

Verify Many:Approvals.Approve(results, "label");

Page 18: Test drivendevelopment   fluency

Multiple Cases

Approvals.Approve(cases, c => TestWith(c));

Page 19: Test drivendevelopment   fluency

Maintaining TestsSame Quality as Production Code

Page 20: Test drivendevelopment   fluency
Page 21: Test drivendevelopment   fluency

ResourcesTest Driven Development: By Example

Kent Beck

Page 22: Test drivendevelopment   fluency

Resourceswww.ApprovalTests.com

Page 23: Test drivendevelopment   fluency

Resources

Intro To TDD Class (4 Day)Legacy Code

www.Develop.com

Page 24: Test drivendevelopment   fluency

TeachingKidsProgramming.orgDo a Recipe Teach a Kid (Ages 10 ++)Microsoft SmallBasic Free Courseware (recipes)

Page 25: Test drivendevelopment   fluency

Please fill out evaluations:TDD – Fluency #AT11

@LlewellynFalcohttp://LlewellynFalco.Blogspot.comhttp://www.approvaltests.com @ArloBelshee

(Microsoft)http://www.arlobelshee.com