Slide 1

Slide 1 text

Intro to Test Driven Development

Slide 2

Slide 2 text

Jim Holmes Executive Consultant, Guidepost Systems LLC [email protected] GitHub: JimHolmes Xbox: FrazzledDad Blogs: http://GuidepostSystems.com http://FrazzledDad.com Coding for Non-Coders: Lesson 1—Course Introduction Who am I?

Slide 3

Slide 3 text

Slides: https://speakerdeck.com/ jimholmes/intro-to-tdd

Slide 4

Slide 4 text

How do you know your stuff works?

Slide 5

Slide 5 text

How do you know you built the right thing?

Slide 6

Slide 6 text

How do you keep your stuff working?

Slide 7

Slide 7 text

Goals for today: Talk about building test cases Spend some writing tests and code

Slide 8

Slide 8 text

Level Set: What are all y’all working with? (testing, specs, etc.)

Slide 9

Slide 9 text

Why writing tests matters

Slide 10

Slide 10 text

Correctness

Slide 11

Slide 11 text

Maintainability

Slide 12

Slide 12 text

Why writing tests first matters

Slide 13

Slide 13 text

Stay lean

Slide 14

Slide 14 text

Focus on value

Slide 15

Slide 15 text

Red Refactor Green

Slide 16

Slide 16 text

Think Refactor Green Red

Slide 17

Slide 17 text

The problem

Slide 18

Slide 18 text

Customer wants a payroll system

Slide 19

Slide 19 text

Today’s work: Figure payroll for hourly workers

Slide 20

Slide 20 text

Let’s write some specs!

Slide 21

Slide 21 text

Hours Worked Hourly Rate Wages Should Be 0 10 0 1 10 10 40 10 400 41 10 415 60 10 700 61 10 Error. Requires supervisor review (Business rule!) -1 10 Error. Do not process 1 -1 Error. Do not process 10 Max Value (500) 10 * max value. 10 Max Value + 1 Error. Requires supervisor review (Business rule!) 10 1 10

Slide 22

Slide 22 text

Let’s write some tests!