0
Agile Testing Best Practices       Stephen Ritchie       DCAST March Meeting       19-Mar-2013
Agenda  1   Motivation  2   Principles  3   Obstacles         Excella Consulting   -2-
Motivation             Why Test             Software?               Excella Consulting
Chrysler New Yorker                      Excella Consulting
Motivation             Why Write             Automated               Tests?               Excella Consulting
Achieve Desired Results                            •   Software costs too much                            •   Users demand...
Microscope: Visibility and Insight                               Excella Consulting
Smoke Detector: Problem Detection                           Excella Consulting
Weather Satellite: Advanced Warning                            Excella Consulting
Automated Tests  Make SureSoftware Works  As Intended
Agenda  1   Motivation  2   Principles  3   Obstacles         Excella Consulting   - 12 -
Agile Test Pyramid: VisionTesters                                                                   AutomatedEngineers    ...
Agile Test Pyramid: Reality       Ice-Cream Cone Anti-Pattern         http://bit.ly/10QpUFG                              E...
Agile Test Quadrants                       Excella Consulting
Principles             1. Unit Test    Developer Tests “Intention Checking”                Excella Consulting
Principles             2. Automate                  • Always running                  • Cant be bargained with            ...
Principles             2. Automate                  • CI Server                     • Per Commit                     • Ove...
Principles   3. Zero Configuration* I can run your tests, You can run mine.       * One-time configuration is okay        ...
Principles                  4. Fast             All tests run             time efficiently                   Excella Consu...
Principles             5. Clear Results                Pass/Fail             Focused Test             Isolates Issue      ...
Principles        6. Easy to Maintain             Conventional                Brief                 Excella Consulting
Principles             7. TimelyTest-Driven Development (TDD)        Test As-It’s-Built        Test As-It’s-Fixed         ...
Agenda  1   Motivation  2   Principles  3   Obstacles         Excella Consulting   - 24 -
Requirements, Requirements, Requirements                  Obstacle 1        •Too Abstract        •Changing        •Over Sp...
Specification by ExampleExamples & Feature Files                           Excella Consulting
One Primary Assert To Rule Them All      One Primary Assert                            Excella Consulting
Time Crunch               Obstacle 2              Time Crunch                  Excella Consulting
Four Ways to Fake Time                  Fake Time            • Virtual Machine            • Isolate The System            ...
Dummy               Real SystemClock               Clock        IClock        Interface  System Under Test
Database Killed The Integration Test                   Obstacle 3                   Database                   Integration...
Fixture Setup and Data Arrangement                           Excella Consulting
Fixture Setup and Data Arrangement• Schema Migration   – RoundhousE   – Flyway Db   – Liquibase• Data Arrangement   – DbUn...
Now We Have Too Much Test Code                 Obstacle 4                 Explosion of                 Test Code          ...
Monitor Test Code Growth Rate            Control Growth            • Monitor The Ratio            • Data-Drive Tests      ...
Bad Coupling      Obstacle 5  Unhelpful Reuse  Unhelpful Repetition  Unhelpful Coupling               Excella Consulting
In Test Code, Do Repeat Yourself ... Do Repeat Yourself   Test Code Is Different    • Avoid Inheritance Reuse    • Use “Co...
Agenda  1   Motivation  2   Principles  3   Obstacles         Excella Consulting   - 41 -
Of Course It’s Safe … After You                             Excella Consulting
Shameless Self Promotion Time!                                        • “Best Practices” Initiative                       ...
Code and Slides• Code:           https://github.com/ruthlesshelp• Slides:         http://www.slideshare.net/ruthlesshelp  ...
Contact Me      •   Email:      stephen.ritchie@excella.com      •   Twitter:    @ruthlesshelp      •   Blog:       http:/...
Agile Testing Best Practices
Agile Testing Best Practices
Agile Testing Best Practices
Agile Testing Best Practices
Upcoming SlideShare
Loading in...5
×

Agile Testing Best Practices

3,198

Published on

Have you ever bumped into a wall with your automated tests? Many developers bump into various roadblocks and hurdles when writing test code. Are your test methods starting to fail because the code-under-test uses the current date and time? Are your automated integration tests failing because the database they integrate with keeps changing? Do you have an explosion of test methods, with the ratio of test code to code-under-test way too high? Is your effort to refactor and improve code overwhelmed by the time it takes to rewrite all those failing unit tests? This presentation is about clearing away Agile testing obstacles, avoiding common pitfalls, and staying away from dangerous practices.

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
3,198
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
108
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Transcript of "Agile Testing Best Practices"

  1. 1. Agile Testing Best Practices Stephen Ritchie DCAST March Meeting 19-Mar-2013
  2. 2. Agenda 1 Motivation 2 Principles 3 Obstacles Excella Consulting -2-
  3. 3. Motivation Why Test Software? Excella Consulting
  4. 4. Chrysler New Yorker Excella Consulting
  5. 5. Motivation Why Write Automated Tests? Excella Consulting
  6. 6. Achieve Desired Results • Software costs too much • Users demand quality • Testing takes too long • New features take too long Excella Consulting
  7. 7. Microscope: Visibility and Insight Excella Consulting
  8. 8. Smoke Detector: Problem Detection Excella Consulting
  9. 9. Weather Satellite: Advanced Warning Excella Consulting
  10. 10. Automated Tests Make SureSoftware Works As Intended
  11. 11. Agenda 1 Motivation 2 Principles 3 Obstacles Excella Consulting - 12 -
  12. 12. Agile Test Pyramid: VisionTesters AutomatedEngineers Google “Agile Test Pyramid” http://bit.ly/10Qubsy Excella Consulting
  13. 13. Agile Test Pyramid: Reality Ice-Cream Cone Anti-Pattern http://bit.ly/10QpUFG Excella Consulting
  14. 14. Agile Test Quadrants Excella Consulting
  15. 15. Principles 1. Unit Test Developer Tests “Intention Checking” Excella Consulting
  16. 16. Principles 2. Automate • Always running • Cant be bargained with • Cant be reasoned with • Tests dont feel pity or remorse or fear • Absolutely will not stop, ever, until you deliver a quality software product. Excella Consulting
  17. 17. Principles 2. Automate • CI Server • Per Commit • Overnight Functional • Smoke Testing • Stability Testing • Performance/Load • Automate Deployments • Project “Dashboard” Excella Consulting
  18. 18. Principles 3. Zero Configuration* I can run your tests, You can run mine. * One-time configuration is okay Excella Consulting
  19. 19. Principles 4. Fast All tests run time efficiently Excella Consulting
  20. 20. Principles 5. Clear Results Pass/Fail Focused Test Isolates Issue Excella Consulting
  21. 21. Principles 6. Easy to Maintain Conventional Brief Excella Consulting
  22. 22. Principles 7. TimelyTest-Driven Development (TDD) Test As-It’s-Built Test As-It’s-Fixed Excella Consulting
  23. 23. Agenda 1 Motivation 2 Principles 3 Obstacles Excella Consulting - 24 -
  24. 24. Requirements, Requirements, Requirements Obstacle 1 •Too Abstract •Changing •Over Specification Excella Consulting
  25. 25. Specification by ExampleExamples & Feature Files Excella Consulting
  26. 26. One Primary Assert To Rule Them All One Primary Assert Excella Consulting
  27. 27. Time Crunch Obstacle 2 Time Crunch Excella Consulting
  28. 28. Four Ways to Fake Time Fake Time • Virtual Machine • Isolate The System • Inspect The Clock • Dummy IClock Excella Consulting
  29. 29. Dummy Real SystemClock Clock IClock Interface System Under Test
  30. 30. Database Killed The Integration Test Obstacle 3 Database Integration Excella Consulting
  31. 31. Fixture Setup and Data Arrangement Excella Consulting
  32. 32. Fixture Setup and Data Arrangement• Schema Migration – RoundhousE – Flyway Db – Liquibase• Data Arrangement – DbUnit & NDbUnit Excella Consulting
  33. 33. Now We Have Too Much Test Code Obstacle 4 Explosion of Test Code Excella Consulting
  34. 34. Monitor Test Code Growth Rate Control Growth • Monitor The Ratio • Data-Drive Tests • Boundary Analysis Excella Consulting
  35. 35. Bad Coupling Obstacle 5 Unhelpful Reuse Unhelpful Repetition Unhelpful Coupling Excella Consulting
  36. 36. In Test Code, Do Repeat Yourself ... Do Repeat Yourself Test Code Is Different • Avoid Inheritance Reuse • Use “Context” Helpers • Repetition Is Better Than Coupling Excella Consulting
  37. 37. Agenda 1 Motivation 2 Principles 3 Obstacles Excella Consulting - 41 -
  38. 38. Of Course It’s Safe … After You Excella Consulting
  39. 39. Shameless Self Promotion Time! • “Best Practices” Initiative • Tips and Tricks • Generate Ideas • Quantifying Value • Biases & Aversions • Tools & Technologies • Avoid Making the Same Mistake Once. Excella Consulting
  40. 40. Code and Slides• Code: https://github.com/ruthlesshelp• Slides: http://www.slideshare.net/ruthlesshelp Excella Consulting
  41. 41. Contact Me • Email: stephen.ritchie@excella.com • Twitter: @ruthlesshelp • Blog: http://ruthlesslyhelpful.net • LinkedIn: http://www.linkedin.com/in/sritchie Excella Consulting
  1. A particular slide catching your eye?

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

×