Your SlideShare is downloading. ×
0
Acceptance
Test
Driven
Development
What is the difference
with
TDD?
Unit Tests
One class
One method
No dependencies
(mocks)
Core of TDD
Rules of TDD
http://bit.ly/1fnUgW6
You are not allowed to
write any production
code unless it is to make a
failing unit test pass.
Rule #1
You are not allowed to
write any more of a unit
test than is sufficient to
fail; and compilation
failures are failures
Rule...
You are not allowed to
write any more
production code than is
sufficient to pass the one
failing unit test
Rule #3
1. Unit Test First (no excuse)
2. Minimal test code
3. Minimal production code
Summary
More than
one class
Communication
between
components
Acceptance tests
What is the limit
of TDD?
Expectations
Reality
What happened?
End to end
Black box testing
Works with
Legacy Code
Works with
New Code
Works with
-40!!!
Core of BDD
(also called ATDD)
Narrowing the gap
Fail Fast
Where can we fail?
Analysis?
Implementation?
QA?
Deploy?
Demo?
Acceptance Criteria
First
Rules of ATDD
You are not allowed to
write any unit test code
unless it is to make a
failing acceptance
criteria pass.
Rule #1
You are not allowed to
write any more of one
acceptance criteria that
is sufficient to fail
Rule #2
Define your acceptance
criteria as a group
Rule #3
1. Acceptance Criteria First
2. Minimal TDD
3. Define the criteria as a
group
Summary
ATDD Flow
Write a Criteria
Pass?
TDD Cycle
NOYES
Feature Driven
Benefits
Adding value on
every step
Benefits
High Quality
Benefits
Regression
Testing
Benefits
Writing Scenarios
(Acceptance Criteria)
A User Story
may have multiple paths
Each path represents a
possible scenario
Each scenario is a
sequence of steps
Each scenario is a
sequence of steps
Write scenarios for a user
login story
Post-It
&
Sharpie!
Exercise
Scenario: Valid credentials
Given I have valid credentials
When I login to the movie library
Then I see my dashboard
User ...
Scenario: Invalid credentials
Given I don’t remember my password
When I login to the movie library
Then I see a message to...
Scenario: Using google Oauth
Given I have an account with google
When I login choosing google
Then I can see my dashboard
...
Gherkin DSL
Given
The state of the application
in order for the scenario to
run successfully
When
The action that has to be
completed in the current
scenario
Then
The acceptance criteria
that the scenario uses in
order to ensure success
Rewrite one of your
scenarios using
Given, When, Then, And
Post-It
&
Sharpie!
Exercise
Guidelines
_ _ _ _ _ _ _ _ _ ?
Scenario: Everything is awesome
Given the application is setup
When I want to use some projects
Then I...
Scenario: Redirect user to originally requested page
Given a User "dave" exists with password "secret"
And I am not logged...
Scenario: List all projects
Given I'm logged in
And I have some projects stored
When I list all the projects
Then I should...
Complexity
How can we estimate a
feature using scenarios?
COMPLEX ∝ #SCENARIOS
0
1
2
4
5
6
7
Simple Medium Complex WTF?
Scenarios
Complexity
COMPLEXITY ∝ CLARITY
Too many steps
Too long to write
Nobody can understand it
Scenario Order
What should go first?
List movies or create
movies?
Size Matters
How many scenarios per
story?
Make every story around the
same size
•One or two scenarios most
•Or break it down
Recipe - Step I
Time limit (days) to each
feature
•After one or two days
•break it down
Recipe - Step II
Choose simplest story-
scenario to flush out
implementation and discover
new requirements
Recipe - Step III
Demo
Summary
Benefits
• Easier planning
• Discovers functionality
and complexity
• No particular skill
required
• Easy Adoption
• Puts t...
Challenges
•Requires discipline
•Owner must participate
•Roles get blured
•QA changes drastically
Thank you!
amir@barylko.com
@abarylko
http://bit.ly/abarylkop
Photo Credit
• Under http://creativecommons.org/licenses/by/2.5/
• Joe Cheng, DSC_7820-01, http://flic.kr/p/2Zt2u
• Bill W...
Photo Credit 2
• How to write good code, http://xkcd.com/844/
• Understanding flow charts, http://lifehacker.com/5909501/h...
Acceptance Test Driven Development
Acceptance Test Driven Development
Acceptance Test Driven Development
Upcoming SlideShare
Loading in...5
×

Acceptance Test Driven Development

478

Published on

Presentation about using acceptance testing to write first acceptance criteria using scenarios to ensure what you get is what you wanted

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

No Downloads
Views
Total Views
478
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
10
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Transcript of "Acceptance Test Driven Development"

  1. 1. Acceptance Test Driven Development
  2. 2. What is the difference with TDD?
  3. 3. Unit Tests
  4. 4. One class One method
  5. 5. No dependencies (mocks)
  6. 6. Core of TDD
  7. 7. Rules of TDD http://bit.ly/1fnUgW6
  8. 8. You are not allowed to write any production code unless it is to make a failing unit test pass. Rule #1
  9. 9. You are not allowed to write any more of a unit test than is sufficient to fail; and compilation failures are failures Rule #2
  10. 10. You are not allowed to write any more production code than is sufficient to pass the one failing unit test Rule #3
  11. 11. 1. Unit Test First (no excuse) 2. Minimal test code 3. Minimal production code Summary
  12. 12. More than one class
  13. 13. Communication between components
  14. 14. Acceptance tests
  15. 15. What is the limit of TDD?
  16. 16. Expectations
  17. 17. Reality
  18. 18. What happened?
  19. 19. End to end
  20. 20. Black box testing
  21. 21. Works with Legacy Code
  22. 22. Works with New Code
  23. 23. Works with -40!!!
  24. 24. Core of BDD (also called ATDD)
  25. 25. Narrowing the gap
  26. 26. Fail Fast
  27. 27. Where can we fail?
  28. 28. Analysis? Implementation? QA? Deploy? Demo?
  29. 29. Acceptance Criteria First
  30. 30. Rules of ATDD
  31. 31. You are not allowed to write any unit test code unless it is to make a failing acceptance criteria pass. Rule #1
  32. 32. You are not allowed to write any more of one acceptance criteria that is sufficient to fail Rule #2
  33. 33. Define your acceptance criteria as a group Rule #3
  34. 34. 1. Acceptance Criteria First 2. Minimal TDD 3. Define the criteria as a group Summary
  35. 35. ATDD Flow Write a Criteria Pass? TDD Cycle NOYES
  36. 36. Feature Driven Benefits
  37. 37. Adding value on every step Benefits
  38. 38. High Quality Benefits
  39. 39. Regression Testing Benefits
  40. 40. Writing Scenarios (Acceptance Criteria)
  41. 41. A User Story may have multiple paths
  42. 42. Each path represents a possible scenario
  43. 43. Each scenario is a sequence of steps
  44. 44. Each scenario is a sequence of steps
  45. 45. Write scenarios for a user login story Post-It & Sharpie! Exercise
  46. 46. Scenario: Valid credentials Given I have valid credentials When I login to the movie library Then I see my dashboard User Login
  47. 47. Scenario: Invalid credentials Given I don’t remember my password When I login to the movie library Then I see a message to recover my password User Login II
  48. 48. Scenario: Using google Oauth Given I have an account with google When I login choosing google Then I can see my dashboard User Login II
  49. 49. Gherkin DSL
  50. 50. Given The state of the application in order for the scenario to run successfully
  51. 51. When The action that has to be completed in the current scenario
  52. 52. Then The acceptance criteria that the scenario uses in order to ensure success
  53. 53. Rewrite one of your scenarios using Given, When, Then, And Post-It & Sharpie! Exercise
  54. 54. Guidelines
  55. 55. _ _ _ _ _ _ _ _ _ ? Scenario: Everything is awesome Given the application is setup When I want to use some projects Then I should be able to load data And have a great user experience but no bugs should appear
  56. 56. Scenario: Redirect user to originally requested page Given a User "dave" exists with password "secret" And I am not logged in When I navigate to the home page Then I am redirected to the login form When I fill in "Username" with "dave" And I fill in "Password" with "secret" And I press "Login" _ _ _ _ _ _ _ _ _ ?
  57. 57. Scenario: List all projects Given I'm logged in And I have some projects stored When I list all the projects Then I should see all of them _ _ _ _ _ _ _ _ _ ?
  58. 58. Complexity How can we estimate a feature using scenarios?
  59. 59. COMPLEX ∝ #SCENARIOS 0 1 2 4 5 6 7 Simple Medium Complex WTF? Scenarios Complexity
  60. 60. COMPLEXITY ∝ CLARITY Too many steps Too long to write Nobody can understand it
  61. 61. Scenario Order What should go first? List movies or create movies?
  62. 62. Size Matters How many scenarios per story?
  63. 63. Make every story around the same size •One or two scenarios most •Or break it down Recipe - Step I
  64. 64. Time limit (days) to each feature •After one or two days •break it down Recipe - Step II
  65. 65. Choose simplest story- scenario to flush out implementation and discover new requirements Recipe - Step III
  66. 66. Demo
  67. 67. Summary
  68. 68. Benefits • Easier planning • Discovers functionality and complexity • No particular skill required • Easy Adoption • Puts the whole team on the same page • Simplifies QA process • Narrows the gap between expectations and actual implementation
  69. 69. Challenges •Requires discipline •Owner must participate •Roles get blured •QA changes drastically
  70. 70. Thank you!
  71. 71. amir@barylko.com @abarylko http://bit.ly/abarylkop
  72. 72. Photo Credit • Under http://creativecommons.org/licenses/by/2.5/ • Joe Cheng, DSC_7820-01, http://flic.kr/p/2Zt2u • Bill Ward, Derek Schin's Trucks 1, http://flic.kr/p/m5L5S • Jeremy Keith, Roast beef, http://flic.kr/p/TKUz • Rob Campbell, Field of daisies, http://flic.kr/p/6QJjU4 • Karin Dalziel, The Thinker, http://flic.kr/p/4UYArc • Under http://creativecommons.org/licenses/by-sa/3.0/us/ • Derick Bailey, SOLID Motivational Posters, http://bit.ly/17aVaHg
  73. 73. Photo Credit 2 • How to write good code, http://xkcd.com/844/ • Understanding flow charts, http://lifehacker.com/5909501/how-to- choose-the-best-chart-for-your-data
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×