MF
AM Half day Tutorial
11/11/2013 8:30 AM

"Acceptance Test-Driven
Development:
Mastering Agile Testing"
Presented by:
Na...
Nate Oster
CodeSquads, LLC

An agile player-coach and founder of CodeSquads, Nate Oster helps
clients adopt lean and agile...
MASTERING AGILE TESTING
Nate Oster
CodeSquads LLC
NATE OSTER
Agile Player-Coach &
Founder, CodeSquads
Focused on adopting
Lean & Agile methods
Mail: Nate.Oster@codesquads.c...
LEARNING OBJECTIVES
Stop finding bugs after development!
Shift from tests as verification to
tests as specification by learni...
AGENDA

Agile Testing has limits
Simulation: Tests as Verification
ATDD Intro or How I Was Dragged Into Testing First
Simul...
AGENDA

Specification by Example
Simulation: Examples using Tables
Simulation: Examples using Given-When-Then
Wrap-up: Acti...
SIMULATION:
TESTS AS VERIFICATION
SIMULATION:
TESTS AS VERIFICATION
Teams of 3 or 4
“Develop” an image by
punching graph paper
“Test” your solution
by fittin...
ACCEPTANCE TESTDRIVEN DEVELOPMENT
Stop testing bugs out.
Start building quality in.
Anatomy(of(an(Itera-on(
2(–(4(week(-mebox(
Define(

Define(
Build(

Define(
Build(

Build(

Test(

Define(

Test(

Build(

Tes...
SIMULATION:
TESTS AS SPECIFICATION
SIMULATION:
TESTS AS SPECIFICATION
Start each story by outlining the acceptance criteria
Specify acceptance tests as concr...
RETROSPECTIVE:
TESTS AS SPECIFICATION
Prepare to Share:

Reflect:
Where your
hypotheses correct?
Why or why not?

Appoint a...
SPECIFICATION BY EXAMPLE
“An example would be helpful right about now.”
- Brian Marick
Essential

Incidental

Hat tip: Dale Emery

©CodeSquads LLC “Mastering Agile Testing”
Agile&Tes)ng&Quadrants&
Business-facing Tests

Acceptance Tests

Unit & Component Tests

Automated
Frameworks

Exploratory...
The$Test$Automa,on$Pyramid$
Exploratory
/Manual

GUI
More business
facing, realistic

Sn

Acceptance Tests
(API Layer)

Fi...
THE TEST AUTOMATION PYRAMID

Push tests as low as
possible in the pyramid
Have tests focus on
intent, not implementation
T...
SOME TOOLS FOR
EXECUTABLE SPECIFICATIONS
TOOL

TECHNOLOGY
SWEET SPOT

FitNesse

Java (native)
.NET (plugin)

Cucumber

Rub...
SIMULATION:
SPECIFICATION BY EXAMPLE
USING TABLES
TABLE-BASED
SPECIFICATIONS
(Re)-build a brokerage
pricing engine
Start with the simplest
scenarios using
realistic example...
Pricing.Stocks
Trade Source Ticker Buy/Sell
Internet
GOOG
Buy
Internet
GOOG
Sell
IVR
GOOG
Buy

Order Type
Limit
Limit
Mark...
USE REASONABLE DEFAULTS
Eliminate duplication with conventions
Document the conventions with examples!
Trade Source
Intern...
PREFER CONCRETE EXAMPLES
OVER ABSTRACTIONS
It’s tempting to save time with abstract examples
We lose time maintaining “sma...
OPERANDS != CLARITY
Operands and inequalities can actually obscure intent
Each operand conceals at least two test cases
Op...
Pricing. MutualFunds. NTF. ShortTermRedemption

No Transaction Fee
Mutual Funds
180 days or less
No commission

Ticker
MNT...
WHAT IF I BUY TWICE
IN 180 DAYS?
TABLES MAY NOT BE EXPRESSIVE
ENOUGH FOR SOME SCENARIOS
What if I buy the same fund
more than once in 180 days?
What if I s...
SIMULATION:
SPECIFICATION BY EXAMPLE
USING TEST LINGOS*
*Credit to Patrick Wilson-Welsh and Dawn Cannon
for coining the te...
LINGO-BASED
SPECIFICATIONS

GIVEN - Context
WHEN - Event
THEN - Outcome
©CodeSquads LLC “Mastering Agile Testing”
THINKING WITH
GIVEN-WHEN-THEN
Scenario: Buying a no-load mutual fund
charges a commission.
Given I do not own fund MNLD.
W...
Pricing. MutualFunds.Buy
Scenario: Buy a mutual fund.

Test Funds
Ticker
MNTF
MNLD
MFEE

Fund Type
NTF
No-Load
Load

Load ...
Pricing. MutualFunds. NTF. ShortTermRedemption

No Transaction Fee
Mutual Funds
180 days or less
No commission

Ticker
MNT...
GIVEN-WHEN-THEN CAN BE MORE
EXPRESSIVE THAN TABLES
What if I buy the same fund
more than once in 180 days?
What if I sell ...
Mutual Fund Short Term Redemptions
No transaction fee (NTF) funds held 180 days or less are
subject to a Short Term Redemp...
Scenario: Part of sale held less than 180 days charges
short term redemption fee.
Given I own MNTF
|shares| days held |
| ...
NEW FEATURE:
CONCIERGE LEVEL PRICING
Concierge Level pricing is a trial promotion.
It offers selected customers free inter...
Feature: Concierge pricing promotion.
Background:
Given the concierge pricing promotion is active.
Scenario Outline: Buyin...
REVIEW
WRAP-UP: CREATE AN
ACTION PLAN
THE PROBLEM

Finding defects is expensive
Rework, Scrap, Delays
Feedback speed is limited

©CodeSquads LLC “Mastering Agil...
GRASSROOTS FIRST STEPS

The Triad: Use specification by example at a
whiteboard with a dev, analyst, and tester
Steel Threa...
WRAP-UP: CREATE AN
ACTION PLAN
What outcomes could specification by example
improve on your teams?
What impediments to adop...
RESOURCES
Learn More:

Experiment:

Specification by Example
(Gojko Adzic)
nate.oster@codesquads.com
The Cucumber Book
Twit...
MASTERING AGILE TESTING

“Mastering+Agile+Tes/ng+Workshop”+copyright+©CodeSquads+LLC.++All#rights#reserved.
These+material...
Acceptance Test-Driven Development: Mastering Agile Testing
Acceptance Test-Driven Development: Mastering Agile Testing
Upcoming SlideShare
Loading in...5
×

Acceptance Test-Driven Development: Mastering Agile Testing

702

Published on

On agile teams, testers can struggle to keep up with the pace of development if they continue employing a waterfall-based verification process—finding bugs after development. Nate Oster challenges you to question waterfall assumptions and replace this legacy verification testing with acceptance test-driven development (ATDD). With ATDD, you “test first” by writing executable specifications for a new feature before development begins. Learn to switch from “tests as verification” to “tests as specification” and to guide development with acceptance tests written in the language of your business. Get started by joining a team for a simulation and experience how ATDD helps build quality in instead of trying to test defects out. Then progress to increasingly more realistic scenarios and practice the art of specifying intent with plain-language and table-based formats. This isn’t a “tools” session. These are tabletop, paper-based simulations that give you meaningful practice with how executable specifications change the way you think about tests and collaborate as a team. Leave empowered with a kit of exercises to advocate ATDD with your own teams.

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

  • Be the first to like this

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

No notes for slide

Transcript of "Acceptance Test-Driven Development: Mastering Agile Testing"

  1. 1. MF AM Half day Tutorial 11/11/2013 8:30 AM "Acceptance Test-Driven Development: Mastering Agile Testing" Presented by: Nate Oster CodeSquads, LLC Brought to you by: 340 Corporate Way, Suite 300, Orange Park, FL 32073 888 268 8770 904 278 0524 sqeinfo@sqe.com www.sqe.com
  2. 2. Nate Oster CodeSquads, LLC An agile player-coach and founder of CodeSquads, Nate Oster helps clients adopt lean and agile methods. Nate builds high-performance teams that adapt to change, embrace a pragmatic philosophy of continuous improvement, measure progress with new features, and deliver high-quality software that delights customers. As a coach, he inspires adopters with hands-on mentoring and simulations that provide a safe learning environment for new ideas. Nate promotes testing as a serious technical discipline. While Nate maintains a speaking schedule at software development conferences, he spends most of his time as a hands-on advisor to software product teams from startups to multinationals. Nate is easily defeated at all card games. Contact him at NateOster@CodeSquads.com.
  3. 3. MASTERING AGILE TESTING Nate Oster CodeSquads LLC
  4. 4. NATE OSTER Agile Player-Coach & Founder, CodeSquads Focused on adopting Lean & Agile methods Mail: Nate.Oster@codesquads.com Twitter: nateoster Voice: 703.930.4100
  5. 5. LEARNING OBJECTIVES Stop finding bugs after development! Shift from tests as verification to tests as specification by learning to test first. Simulate the feel of ATDD in a non-threatening way Gain meaningful practice with table-based and plain-language formats for specifying intent. Leave empowered to advocate ATDD with your own teams and managers! ©CodeSquads LLC “Mastering Agile Testing”
  6. 6. AGENDA Agile Testing has limits Simulation: Tests as Verification ATDD Intro or How I Was Dragged Into Testing First Simulation: Tests as Specification ©CodeSquads LLC “Mastering Agile Testing”
  7. 7. AGENDA Specification by Example Simulation: Examples using Tables Simulation: Examples using Given-When-Then Wrap-up: Action Planning ©CodeSquads LLC “Mastering Agile Testing”
  8. 8. SIMULATION: TESTS AS VERIFICATION
  9. 9. SIMULATION: TESTS AS VERIFICATION Teams of 3 or 4 “Develop” an image by punching graph paper “Test” your solution by fitting it over pegs Satisfy your Customer! ©CodeSquads LLC “Mastering Agile Testing”
  10. 10. ACCEPTANCE TESTDRIVEN DEVELOPMENT Stop testing bugs out. Start building quality in.
  11. 11. Anatomy(of(an(Itera-on( 2(–(4(week(-mebox( Define( Define( Build( Define( Build( Build( Test( Define( Test( Build( Test( Define( Define( Build( Test( Build( Test( Define( Test( Build( Test( Itera-on(Planning…( Retrospec-ve( Itera-on(Demo( Itera-on(Planning( Feature( Team( Build( Test( Define( a(f ( y… da xt( ne rs( ou ( 2(h ours (h 2@4 urs ( urs ys( (d a ew (h o ew a(f (ho 2@4 ( Nate%Oster,%“The%Agile%Challenge”%Workshop,%CodeSquads%LLC.% ©CodeSquads LLC “Mastering Agile Testing”
  12. 12. SIMULATION: TESTS AS SPECIFICATION
  13. 13. SIMULATION: TESTS AS SPECIFICATION Start each story by outlining the acceptance criteria Specify acceptance tests as concrete examples If we don’t know when we’re done, then why are we starting? Hypothesize the top 3 effects of this change ©CodeSquads LLC “Mastering Agile Testing”
  14. 14. RETROSPECTIVE: TESTS AS SPECIFICATION Prepare to Share: Reflect: Where your hypotheses correct? Why or why not? Appoint a scribe Share your results at your tables List the top improvements ©CodeSquads LLC “Mastering Agile Testing”
  15. 15. SPECIFICATION BY EXAMPLE “An example would be helpful right about now.” - Brian Marick
  16. 16. Essential Incidental Hat tip: Dale Emery ©CodeSquads LLC “Mastering Agile Testing”
  17. 17. Agile&Tes)ng&Quadrants& Business-facing Tests Acceptance Tests Unit & Component Tests Automated Frameworks Exploratory Tests Usability Testing UAT Performance Testing Security analysis “-ility” tests Technology-facing Tests Mostly Manual Tests that critique the product Tests that support the Team Mostly Automated Specialized Tools “Agile Testing,” Lisa Crispin & Janet Gregory, used with permission (originally Brian Marick, 2006)
  18. 18. The$Test$Automa,on$Pyramid$ Exploratory /Manual GUI More business facing, realistic Sn Acceptance Tests (API Layer) FitNesse/ Cuke Lower-cost Easier maintenance Faster feedback xUnit Unit & Component Tests Adapted from Mike Cohn (Automated Test Pyramid) & “Agile Testing”, Lisa Crispin & Janet Gregory.. ©CodeSquads LLC “Mastering Agile Testing”
  19. 19. THE TEST AUTOMATION PYRAMID Push tests as low as possible in the pyramid Have tests focus on intent, not implementation Team decides appropriate level for each test ©CodeSquads LLC “Mastering Agile Testing”
  20. 20. SOME TOOLS FOR EXECUTABLE SPECIFICATIONS TOOL TECHNOLOGY SWEET SPOT FitNesse Java (native) .NET (plugin) Cucumber Ruby (native) Java (CucumberJVM) .NET (plugin) SpecFlow .NET (native) ©CodeSquads LLC “Mastering Agile Testing”
  21. 21. SIMULATION: SPECIFICATION BY EXAMPLE USING TABLES
  22. 22. TABLE-BASED SPECIFICATIONS (Re)-build a brokerage pricing engine Start with the simplest scenarios using realistic examples Be customer-focused! ©CodeSquads LLC “Mastering Agile Testing”
  23. 23. Pricing.Stocks Trade Source Ticker Buy/Sell Internet GOOG Buy Internet GOOG Sell IVR GOOG Buy Order Type Limit Limit Market Commission? $9.99 $9.99 $34.99 [expected “$34.99”, actual “$9.99”] ©CodeSquads LLC “Mastering Agile Testing”
  24. 24. USE REASONABLE DEFAULTS Eliminate duplication with conventions Document the conventions with examples! Trade Source Internet Internet IVR IVR Broker Broker Ticker Buy/Sell GOOG Buy GOOG Sell GOOG Buy GOOG Sell GOOG Buy GOOG Sell Order Type Limit Limit Limit Limit Limit Limit ©CodeSquads LLC “Mastering Agile Testing” Commission? $9.99 $9.99 $34.99 $34.99 $44.99 $44.99
  25. 25. PREFER CONCRETE EXAMPLES OVER ABSTRACTIONS It’s tempting to save time with abstract examples We lose time maintaining “smart tests” that must complete the same calculations as the system. Abstract Example Concrete Examples 4% $40, $4000 Y, N $49.99, $0.00 ‘Correct contents’ 3 spanish onions’ ©CodeSquads LLC “Mastering Agile Testing”
  26. 26. OPERANDS != CLARITY Operands and inequalities can actually obscure intent Each operand conceals at least two test cases Operand Concrete Examples >180 179,180, 181 <= 180 179, 180 > $1,000 $1,001 ©CodeSquads LLC “Mastering Agile Testing”
  27. 27. Pricing. MutualFunds. NTF. ShortTermRedemption No Transaction Fee Mutual Funds 180 days or less No commission Ticker MNTF MNLD MFEE Fund Type NTF No-Load Load $49.99 fee ©CodeSquads LLC “Mastering Agile Testing” Load % N/A N/A 4% on Buy
  28. 28. WHAT IF I BUY TWICE IN 180 DAYS?
  29. 29. TABLES MAY NOT BE EXPRESSIVE ENOUGH FOR SOME SCENARIOS What if I buy the same fund more than once in 180 days? What if I sell when only part of the balance is 180 days old? “An example would be helpful right about now.” - Brian Marick ©CodeSquads LLC “Mastering Agile Testing”
  30. 30. SIMULATION: SPECIFICATION BY EXAMPLE USING TEST LINGOS* *Credit to Patrick Wilson-Welsh and Dawn Cannon for coining the term!
  31. 31. LINGO-BASED SPECIFICATIONS GIVEN - Context WHEN - Event THEN - Outcome ©CodeSquads LLC “Mastering Agile Testing”
  32. 32. THINKING WITH GIVEN-WHEN-THEN Scenario: Buying a no-load mutual fund charges a commission. Given I do not own fund MNLD. When I buy $10,000 in fund MNLD, then the commission is $49.99 and the fee is $0.00. When I buy fund MNLD, then the commission is $49.99. ©CodeSquads LLC “Mastering Agile Testing”
  33. 33. Pricing. MutualFunds.Buy Scenario: Buy a mutual fund. Test Funds Ticker MNTF MNLD MFEE Fund Type NTF No-Load Load Load % N/A N/A 4% on Buy ©CodeSquads LLC “Mastering Agile Testing”
  34. 34. Pricing. MutualFunds. NTF. ShortTermRedemption No Transaction Fee Mutual Funds 180 days or less No commission Ticker MNTF MNLD MFEE Fund Type NTF No-Load Load $49.99 fee ©CodeSquads LLC “Mastering Agile Testing” Load % N/A N/A 4% on Buy
  35. 35. GIVEN-WHEN-THEN CAN BE MORE EXPRESSIVE THAN TABLES What if I buy the same fund more than once in 180 days? What if I sell when only part of the balance is 180 days old? “An example would be helpful right about now.” - Brian Marick ©CodeSquads LLC “Mastering Agile Testing”
  36. 36. Mutual Fund Short Term Redemptions No transaction fee (NTF) funds held 180 days or less are subject to a Short Term Redemption Fee of $49.99. Scenario: Part of sale held less than 180 days charges short term redemption fee. Given I own 100 shares of MNTF for 181 days and I own 100 shares of MNTF for 179 days When I sell 101 shares of MNTF Then I am charged a short term redemption fee of $49.99. Scenario: ... ©CodeSquads LLC “Mastering Agile Testing”
  37. 37. Scenario: Part of sale held less than 180 days charges short term redemption fee. Given I own MNTF |shares| days held | | 100 | 181 | | 100 | 179 | When I sell 101 shares Then I am charged a short term redemption fee. ©CodeSquads LLC “Mastering Agile Testing”
  38. 38. NEW FEATURE: CONCIERGE LEVEL PRICING Concierge Level pricing is a trial promotion. It offers selected customers free internet trades if their total assets exceed $250,000 or if a trade is for more than $10,000. Brainstorm acceptance tests for this feature using tables, given-when-then, or both. Your choice! ©CodeSquads LLC “Mastering Agile Testing”
  39. 39. Feature: Concierge pricing promotion. Background: Given the concierge pricing promotion is active. Scenario Outline: Buying in a selected account. Given a selected account with a balance of <total assets>, when I buy <trade amount> of <ticker> using source <trade source>, then the commission is <fee>. Examples: | total assets | trade amount | ticker | trade source | fee | | $499,999 | $10,001 | GOOG | internet | 0 | | $500,001 | $1,000 | GOOG | internet | 0 | | | | | | | ©CodeSquads LLC “Mastering Agile Testing”
  40. 40. REVIEW
  41. 41. WRAP-UP: CREATE AN ACTION PLAN
  42. 42. THE PROBLEM Finding defects is expensive Rework, Scrap, Delays Feedback speed is limited ©CodeSquads LLC “Mastering Agile Testing”
  43. 43. GRASSROOTS FIRST STEPS The Triad: Use specification by example at a whiteboard with a dev, analyst, and tester Steel Thread: Try executable specifications for a few small bugs or stories Plant Seeds: Host a brownbag and ask for support ©CodeSquads LLC “Mastering Agile Testing”
  44. 44. WRAP-UP: CREATE AN ACTION PLAN What outcomes could specification by example improve on your teams? What impediments to adopting spec by example do you anticipate? How could you overcome these impediments? What small experiments will quickly check your thinking about ATDD on your own teams? ©CodeSquads LLC “Mastering Agile Testing”
  45. 45. RESOURCES Learn More: Experiment: Specification by Example (Gojko Adzic) nate.oster@codesquads.com The Cucumber Book Twitter:Hellesoy) (Aslak nateoster Voice: 703.930.4100 Agile Testing (Lisa Crispin & Janet Gregory) “Pull” in support through your Team’s retrospectives People & Interactions over Processes & Tools! Reach Out: Nate Oster noster@keyholesoftware.com 703-930-4100 (m) ©CodeSquads LLC “Mastering Agile Testing”
  46. 46. MASTERING AGILE TESTING “Mastering+Agile+Tes/ng+Workshop”+copyright+©CodeSquads+LLC.++All#rights#reserved. These+materials+are+provided+under+license+to+individual+par/cipants.++Par/cipants+may+ not+reproduce,+alter,+or+build+upon+these+materials.++Par/cipants+may+not+reuse+these+ materials+for+training+purposes.++Slides+and+diagrams+that+are+specifically+iden/fied+as++ licensed+under+a+Crea/ve+Commons+(CCHBY+2.0+unported+license)+may+be+reproduced+ (without+modifica/on)+if+they+retain+the+aOribu/on+provided.+ ©CodeSquads LLC “Mastering Agile Testing”

×