Get What You Need,
Not What You Ask For!
An Intro to ATDD/BDD and HDD

David Bulkin
David.Bulkin@LitheSpeed.com
About Me
David Bulkin

VP Training Services LitheSpeed
+1.215-764-6822
David.Bulkin@lithespeed.com
@davidbulkin
www.LitheS...
Agile Enablement that’s
pragmatic, not prescriptive.
There is a gap of
understanding between
business and development
Development

Business
There is a also a gap between
what we build and what we
should build.
What we build

What we
should build
In this session, we want to
bridge these gaps…

…and achieve a few
other things along the
way
Perspective before
we start…
TDD
Developer builds what she thinks the
business explained.
1. Write a failing test
As a bonus, get a
better design and
a...
ATDD/BDD
Use shared language to build what
the business really requested.
As a bonus get
automated
acceptance test
HDD	
  
Use shared language
to better understand
what is really needed.
Learn and pivot
for real success!

1. Develop a Bu...
2

Testable
Example
Example: We’re developing an early, basic,
consumer calculator.
It’s 1972, the year of the last Apollo
mission to the moon...
Calculator Constraints
•  8 bits

7

8

9

4

5

6

1

2

3

+

0

=

Clear

•  Can store 0 to 255.
•  Unsigned, meaning t...
With this calculator, the user can:
• 
• 
• 
• 

Enter a number
Enter an operand
(plus or minus)
Enter another
number
Pres...
Let’s create simple tests for the results
that do the following:
•  Ensure math is correct
•  Check boundaries
•  Test for...
What I mean by valid sequence of input:

7

8

9

4

5

6

1

2

3

+

0

=

Clear

Not worried about:
•  + +
•  12 - - 10...
Let’s create a test of the math, assuming valid
input, and checking the boundaries of what our
calculator can handle.
Numb...
Let’s create a test of the math, assuming valid
input, and checking the boundaries of what our
calculator can handle.
Numb...
Now that I got
you started, do
some more
examples…
Let’s create a test of the math, assuming valid
input, and checking the boundaries of what our
calculator can handle.
Numb...
t’s
Le
Organ
ize
Our
Happy path tests
Valid Addition
Number (A)

Operand

Number (B)

Result?

 0

+

0

0

0 

+

1

1

99

+

100

199

254

...
Unhappy path tests
Invalid Addition
Number (A)

Operand

Number (B)

Result?

255

+

1

ERR

128

+

128

ERR

Number (B)...
2

Testable
Example
A ticket to Agile Land:
Agile Land Theme Park
Admit One – Ages 3 to 103

•  Valid 364 Days a Year (not valid on Christmas)...
Approximately 1,000 tickets sold and
used each month
1060
1040
1020
1000
980
960
940
920

Jan

Feb

Mar

Apr

May

Jun

Ju...
The Solution:
Quantity
Discounts
Solution Quantity Discount Story:

As a member of a sizable
group
I want to purchase large
blocks of one day passes
So tha...
Acceptance Criteria Pricing
q 

q 

q 

Purchase <= 50 tickets at $50.00
each, from 1 to 50 inclusive
Purchase 51 to 10...
Let’s Create a
Testable Spec…
<= 50 tickets at $50.00 each, from 1 to 50 inclusive
51 to 100 tickets at $40.00 each, from 1 to 100 inclusive
101 or more...
Now that I got you
started…
<= 50 tickets at $50.00 each, from 1 to 50 inclusive 51 to 100
tickets at $40.00 for all tickets, from 1 to 100 inclusive ...
We bridged the gap of
understanding,
but…

Didn’t deliver value!
(We verified but didn’t
validate.)
Let’s Fix Our Acceptance
Criteria…
Acceptance Criteria Pricing
q 
Purchase <= 50 tickets at $50.00 each,
from 1 to 50 inc...
Acceptance Criteria Pricing
q  Purchase <= 50 tickets at $50.00
each, from 1 to 50 inclusive
q  Purchase 51 to 100 ticke...
Let’s Create a
Testable Spec
Purchased Total for Purchased Total for Purchased Total for
Total
0 to 50
0 to 50? 51 to 100 51 to 100? 101 to ∞ 101 to ∞?...
Better!
But, not good
enough!
What’s Next?!
Approximately 1,000 tickets
sold and used each month
1060
1040
1020
1000
980
960
940
920

Jan

Feb

Mar

Apr

May

Jun

Ju...
1060
1040
1020
1000
980
960
940
920

Jan

What do we
expect next
month and
beyond?
Feb

Mar

Apr

May

Jun

Jul

Aug

Sep
...
1060
1040
1020
1000
980
960
940
920

Do we
expect to
sell more?

Jan

Feb

Mar

Apr

May

Jun

Jul

Aug

Sep

Oct

Nov

De...
$$$

What We Would Have Sold?
Price
Level

Qty

Gross?

$50.00

1,000

$50,000

Month 1
Price
Level

Qty?

Gross?

$50.00
...
What
we
get…

What We Would Have Sold?
Price
Level

Qty

Gross?

$50.00

1,000

$50,000

Month 1 - Projected

Month 1 - Ac...
What else
should we
know?
How about average
net revenue from
concessions and
parking per
attendee?
Curren
t

Month Two
Qty?
We are selling close
1,000
1,000
to the expected
 
 
 
number of tickets,
Pricebut, to people who...
Pivot
What would
you do now?
What else do
you need to
know?
Testable
examples work
for the
business too!
In Summary
• 

User stories and acceptance criteria are easily
misunderstood, so support them with testable
examples.

• 
...
Said Another Way…
TDD: Developer building what he/she thinks the
business wants is not enough!
ATDD/BDD: Getting on the sa...
Think about,
align to, and
pivot towards value
with

Hypothesis-Driven
Development (HDD)
Thank You!
David Bulkin

VP Training Services LitheSpeed
+1.215-764-6822
David.Bulkin@lithespeed.com
@davidbulkin
www.Lith...
An Intro to ATDD/BDD and HDD: Get What You Need, Not What You Ask For!
An Intro to ATDD/BDD and HDD: Get What You Need, Not What You Ask For!
An Intro to ATDD/BDD and HDD: Get What You Need, Not What You Ask For!
Upcoming SlideShare
Loading in...5
×

An Intro to ATDD/BDD and HDD: Get What You Need, Not What You Ask For!

319

Published on

Do you want to learn the basics of ATDD/BDD so that you can ensure clear
communications between business and development?

Do you want to go beyond building to a specification, and build what is
valuable instead?

Agile teams often relied on user stories and acceptance criteria alone. Then more advanced teams started doing TDD (Test Driven Development) so that developers could build what they thought the business asked for. When it became clear that TDD was not enough, ATDD (Acceptance Test Driven Development) / BDD (Behaviour Test Driven Development) became popular, as they provide a common language for business and development.

But building what the business wanted is not enough!

With HDD (Hypothesis Driven Development), we can test our business case, just like we test our code. When we find that results don’t match our expectation, we adjust our business case to get better business results.

In this presentation, we'll create several examples in ATDD/BDD and then extend out to the business case level with HDD.

Published in: Technology, Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
319
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

An Intro to ATDD/BDD and HDD: Get What You Need, Not What You Ask For!

  1. 1. Get What You Need, Not What You Ask For! An Intro to ATDD/BDD and HDD David Bulkin David.Bulkin@LitheSpeed.com
  2. 2. About Me David Bulkin VP Training Services LitheSpeed +1.215-764-6822 David.Bulkin@lithespeed.com @davidbulkin www.LitheSpeed.com www.linkedin.com/in/davidbulkin
  3. 3. Agile Enablement that’s pragmatic, not prescriptive.
  4. 4. There is a gap of understanding between business and development Development Business
  5. 5. There is a also a gap between what we build and what we should build. What we build What we should build
  6. 6. In this session, we want to bridge these gaps… …and achieve a few other things along the way
  7. 7. Perspective before we start…
  8. 8. TDD Developer builds what she thinks the business explained. 1. Write a failing test As a bonus, get a better design and automated unit testing. Red 1. Write a failing test Refactor 3. Make code better Green 2. Make code work
  9. 9. ATDD/BDD Use shared language to build what the business really requested. As a bonus get automated acceptance test
  10. 10. HDD   Use shared language to better understand what is really needed. Learn and pivot for real success! 1. Develop a Business Plan Case Learn Ideas Data Build Code Measure 3. Adjust the Business Goals & Approach 2. Deliver Working System
  11. 11. 2 Testable Example
  12. 12. Example: We’re developing an early, basic, consumer calculator. It’s 1972, the year of the last Apollo mission to the moon. 7 8 9 4 5 6 1 2 3 + 0 = Clear
  13. 13. Calculator Constraints •  8 bits 7 8 9 4 5 6 1 2 3 + 0 = Clear •  Can store 0 to 255. •  Unsigned, meaning that it cannot handle negative numbers. •  Handles only plus and minus operations.
  14. 14. With this calculator, the user can: •  •  •  •  Enter a number Enter an operand (plus or minus) Enter another number Press the “=“ to calculate For example, 12 + 10 = 22 14 + 3 = 17 10 – 8 = 2 12   7 4 1 8 75 42 9 +   69 8 3 610   75 8 9 =   + 1- 42*53 8 9 7 6 Cle 22   =2 5 6 ar + 1- 4*73 8 9 Cl =2 3 ear+ 1 4* 5 6 Cl ear + = 2* 3 1Cl 0 ear+ = = Clear
  15. 15. Let’s create simple tests for the results that do the following: •  Ensure math is correct •  Check boundaries •  Test for results our calculator can’t handle •  Checking only for valid sequence of input: 1.  Number 2.  Operand (+ or -) 3.  Number 4.  Equals 7 8 9 4 5 6 1 2 3 + 0 - Clear =
  16. 16. What I mean by valid sequence of input: 7 8 9 4 5 6 1 2 3 + 0 = Clear Not worried about: •  + + •  12 - - 10 •  etc. Just valid entry sequence to test math: 12 + 10 = 22
  17. 17. Let’s create a test of the math, assuming valid input, and checking the boundaries of what our calculator can handle. Number (A) 0 Operand + Number (B) 0 Result? 0
  18. 18. Let’s create a test of the math, assuming valid input, and checking the boundaries of what our calculator can handle. Number (A) 0 0 1 Operand + + + Number (B) 0 1 254 Result? 0 1 255
  19. 19. Now that I got you started, do some more examples…
  20. 20. Let’s create a test of the math, assuming valid input, and checking the boundaries of what our calculator can handle. Number (A) 0 0 1 1 255 1 1 Operand + + + + - Number (B) Result? 0 1 254 255 254 0 2 0 1 255 ERR 1 1 ERR
  21. 21. t’s Le Organ ize Our
  22. 22. Happy path tests Valid Addition Number (A) Operand Number (B) Result?  0 + 0 0 0  + 1 1 99 + 100 199 254 + 1 255 Number (B) Result? Valid Subtraction Number (A) Operand 0 - 0 0 1  - 0 1 100 - 50 50 255 - 255 0
  23. 23. Unhappy path tests Invalid Addition Number (A) Operand Number (B) Result? 255 + 1 ERR 128 + 128 ERR Number (B) Result? Invalid Subtraction Number (A) Operand 0 - 1 ERR 1  - 2 ERR 128 - 200 ERR
  24. 24. 2 Testable Example
  25. 25. A ticket to Agile Land: Agile Land Theme Park Admit One – Ages 3 to 103 •  Valid 364 Days a Year (not valid on Christmas) •  Valid for standard park opening and closing times of 9:00 AM to 9:00 PM •  Valid for one child, 3 and up, or adult •  Provides free access to most park rides and attractions, some attractions are additional.
  26. 26. Approximately 1,000 tickets sold and used each month 1060 1040 1020 1000 980 960 940 920 Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
  27. 27. The Solution: Quantity Discounts
  28. 28. Solution Quantity Discount Story: As a member of a sizable group I want to purchase large blocks of one day passes So that I can get quantity discounts and save money
  29. 29. Acceptance Criteria Pricing q  q  q  Purchase <= 50 tickets at $50.00 each, from 1 to 50 inclusive Purchase 51 to 100 tickets at $40.00 each, from 1 to 100 inclusive Purchase 101 or more tickets at $30.00 each, from 1 to infinity
  30. 30. Let’s Create a Testable Spec…
  31. 31. <= 50 tickets at $50.00 each, from 1 to 50 inclusive 51 to 100 tickets at $40.00 each, from 1 to 100 inclusive 101 or more tickets at $30.00 each, from 1 to infinity Count Price Each Total? 0 $50 $0 1 $50 $50
  32. 32. Now that I got you started…
  33. 33. <= 50 tickets at $50.00 each, from 1 to 50 inclusive 51 to 100 tickets at $40.00 for all tickets, from 1 to 100 inclusive 101 or more tickets at $30.00 each for all tickets, from 1 to infinity Count Price Each Total? 0 $50 $0 1 $50 $50 50 $50 $2,500 51 $40 $2,040 100 $40 $4,000 101 $30 $3,030
  34. 34. We bridged the gap of understanding, but… Didn’t deliver value! (We verified but didn’t validate.)
  35. 35. Let’s Fix Our Acceptance Criteria… Acceptance Criteria Pricing q  Purchase <= 50 tickets at $50.00 each, from 1 to 50 inclusive q  q  Purchase 51 to 100 tickets at $40.00 each, from 1 to 100 inclusive Purchase 101 or more tickets at $30.00 each, from 1 to infinity
  36. 36. Acceptance Criteria Pricing q  Purchase <= 50 tickets at $50.00 each, from 1 to 50 inclusive q  Purchase 51 to 100 tickets at $40.00 each, for tickets 51 to 100 inclusive q  Purchase 101 or more tickets at $30.00 each, for tickets 101 to infinity
  37. 37. Let’s Create a Testable Spec
  38. 38. Purchased Total for Purchased Total for Purchased Total for Total 0 to 50 0 to 50? 51 to 100 51 to 100? 101 to ∞ 101 to ∞? Purchase Count 0 0 $0 0 $0 0 $0 $0 1 1 $50 0 $0 0 $0 $50 50 50 $2,500 0 $0 0 $0 $2,500 51 50 $2,500 1 $40 0 $0 $2,540 100 50 $2,500 50 $2,000 0 $0 $4,500 101 50 $2,500 50 $2,000 1 $30 $4,530
  39. 39. Better!
  40. 40. But, not good enough!
  41. 41. What’s Next?!
  42. 42. Approximately 1,000 tickets sold and used each month 1060 1040 1020 1000 980 960 940 920 Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
  43. 43. 1060 1040 1020 1000 980 960 940 920 Jan What do we expect next month and beyond? Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
  44. 44. 1060 1040 1020 1000 980 960 940 920 Do we expect to sell more? Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
  45. 45. $$$ What We Would Have Sold? Price Level Qty Gross? $50.00 1,000 $50,000 Month 1 Price Level Qty? Gross? $50.00 800 $40,000 $40.00 200 $8,000 $30.00 200 $6,000 1,200 $54,000   We expect more gross revenue!
  46. 46. What we get… What We Would Have Sold? Price Level Qty Gross? $50.00 1,000 $50,000 Month 1 - Projected Month 1 - Actual Gross? Price Level Qty? Gross? 800 $40,000 $50.00 400 $20,000 $40.00 200 $8,000 $40.00 400 $16,000 $30.00 200 $6,000 $30.00 450 $13,500 1,250 $49,500 Price Level Qty? $50.00   1,200 $54,000  
  47. 47. What else should we know?
  48. 48. How about average net revenue from concessions and parking per attendee?
  49. 49. Curren t Month Two Qty? We are selling close 1,000 1,000 to the expected       number of tickets, Pricebut, to people who Level Qty? $50.00 400 $40.00 spend less! 400 Expected Price Level $50.00   $30.00     Actual Ticket Additional Additional Gross? Per Person? Total? $50,000 $20 $20,000             Ticket Additional Additional Gross? Per Person? Total? $20,000 $20 $8,000 $16,000 $20 $8,000 $15,000 $20 $10,000             Ticket Additional Additional Gross? Per Person? Total? $20,000 $20 $8,000 $16,000 $8 $3,200 $13,500 $4 $1,800         Price Level $50.00 $40.00 $30.00   500 1,300 Qty? 400 400 450 1,250   Gross? $70,000 $70,000 Gross? $28,000 $24,000 $25,000 $77,000 Gross? $28,000 $19,200 $15,300 $62,500
  50. 50. Pivot
  51. 51. What would you do now?
  52. 52. What else do you need to know?
  53. 53. Testable examples work for the business too!
  54. 54. In Summary •  User stories and acceptance criteria are easily misunderstood, so support them with testable examples. •  Our business rules are not always well thought out, so use testable examples to question, identify, and fix bad rules •  We often don’t understand the business impact of what we build, so question & prove assumptions with HDD, realign & pivot as necessary!
  55. 55. Said Another Way… TDD: Developer building what he/she thinks the business wants is not enough! ATDD/BDD: Getting on the same page about what to build is good, and questioning what you agreed to with ATDD/BDD is incredibly helpful, but…
  56. 56. Think about, align to, and pivot towards value with Hypothesis-Driven Development (HDD)
  57. 57. Thank You! David Bulkin VP Training Services LitheSpeed +1.215-764-6822 David.Bulkin@lithespeed.com @davidbulkin www.LitheSpeed.com www.linkedin.com/in/davidbulkin

×