Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.

To TDD or not to TDD - that is the question

147 vues

Publié le

A test-driven development experience report based on the 10+ year history of the Jenkins git plugin. Provides examples and heuristics for cases where test-driven development may not be the most effective use of time.

Publié dans : Logiciels
  • Soyez le premier à commenter

  • Soyez le premier à aimer ceci

To TDD or not to TDD - that is the question

  1. 1. TO TDD OR NOT TO TDD – THAT IS THE QUESTION Test-driven development: lessons from the Jenkins Git Plugin Mark Waite 28 Feb 2018 Agile Boulder
  2. 2. AN EXPERIENCE TALK • My biases • My mistakes • My misperceptions This is a biased talk. I’m using my experiences and some data Biased by professional experience • 2003 – Extreme Programming - manager Loved it and lived it for 4 years at a 200 person company • 2007 – Scrum - manager Lived it for 6 years at a 5000 person company • 2013 – More scrum - director Lived it for 3 years at a 10,000 person company • 2017 – Technical evangelist at CloudBees We sell and support Jenkins to Enterprises Biased by personal experience • 2012 – My first commit to Jenkins git plugin (Java) • 2014 – Wrote many tests for git plugin and git client plugin • 2015 – Primary maintainer of git plugin and git client plugin • 2017 – Divided maintainer – I do legacy, Stephen does next gen Biased by beliefs • I believe in Test Driven Development
  3. 3. TEST-DRIVEN DEVELOPMENT • Red – write a small failing test • Green – write to pass the test • Refactor – simplify and improve Three simple steps A lifetime to learn to do it well I love tests. I write tests. I run tests. I fix tests. Photo CC BY-SA 4.0
  4. 4. THE LENS OF PROJECT HISTORY
  5. 5. WHAT IS JENKINS? Leading continuous integration server Open source, started in 2007 as Hudson Became Jenkins in 2011 150,000+ installations worldwide 1,300+ plugins Active community Strong integrations
  6. 6. WHAT IS GIT? Most popular version control system Linux kernel tracked in Git Microsoft Windows tracked in Git Core technology at GitHub, Bitbucket, VS Online, …
  7. 7. JENKINS GIT PLUGIN HISTORY Jenkins Git Plugin connects Jenkins to Git Historical Phases of Jenkins Git Plugin • Early adoption: 2007 - 2010 • Significant growth: 2010 – 2013 • Refactoring: 2013 - 2016 • Pipeline: 2017 - now
  8. 8. EARLY ADOPTION 2007 - 2010 Early adoption questions: • Is git relevant to Jenkins users? • Which git features matter most?
  9. 9. EARLY ADOPTION Unknowns • User value • Feature relevance • Performance measures Integration Hurdles • Few lines of code • Few components used • Few components depend on us
  10. 10. INSTALLS AND TESTS IN EARLY ADOPTION 0 20000 40000 60000 80000 100000 120000 140000 160000 Jan-08 Jan-10 Jan-12 Jan-14 Jan-16 Jan-18 Active Jenkins Git Plugin Installations 0 2000 4000 6000 8000 10000 12000 14000 Jan-08 Jan-10 Jan-12 Jan-14 Jan-16 Jan-18 Jenkins Git Plugin lines of code vs. test LOC LOC Test LOC • User needs are more important than tests • Discover user needs by delivering • Test interactively for fastest delivery
  11. 11. WIDESPREAD USE 2010 - 2013 Widespread use questions: • Easier to use? • Easier to diagnose? • Next features?
  12. 12. WIDESPREAD USE More confident • User value • Feature relevance • Key performance measure Integration Hurdles • More features • More lines of code • More components used • Few components depend on us
  13. 13. INSTALLS AND TESTS IN WIDESPREAD USE 0 20000 40000 60000 80000 100000 120000 140000 160000 Jan-08 Jan-10 Jan-12 Jan-14 Jan-16 Jan-18 Active Jenkins Git Plugin Installations 0 2000 4000 6000 8000 10000 12000 14000 Jan-08 Jan-10 Jan-12 Jan-14 Jan-16 Jan-18 Jenkins Git Plugin lines of code vs. test LOC LOC Test LOC • User needs are more important than tests • Discover user needs by delivering • Test interactively for fastest delivery • Feature and dependency growth is increasing the cost of testing
  14. 14. REFACTORING 2013 - 2016 Resolve implementation problems Git is winning the source control wars More regressions from refactoring Refactor: • add JGit • extract git client
  15. 15. REFACTORING Confident in • User value • Feature relevance • Key performance measures Integration Hurdles • More features • More lines of code • More components used • Many components depend on us
  16. 16. INSTALLS AND TESTS IN REFACTORING 0 20000 40000 60000 80000 100000 120000 140000 160000 Jan-08 Jan-10 Jan-12 Jan-14 Jan-16 Jan-18 Active Jenkins Git Plugin Installations 0 2000 4000 6000 8000 10000 12000 14000 Jan-08 Jan-10 Jan-12 Jan-14 Jan-16 Jan-18 Jenkins Git Plugin lines of code vs. test LOC LOC Test LOC • User needs are often failed by regressions • Discover user needs by delivering • Test automation for fastest delivery • Interactive testing still finds most bugs • Feature and dependency growth is increasing the cost of testing
  17. 17. PIPELINE 2017 - NOW Pipeline: • GitHub, Bitbucket optimizations • Simpler setup and maintenance • Higher performance
  18. 18. PIPELINE Significant new • User value • Features • Key performance improved Integration Hurdles • More features • More lines of code • More components used • Critical part of Jenkins
  19. 19. INSTALLS AND TESTS IN PIPELINE 0 20000 40000 60000 80000 100000 120000 140000 160000 Jan-08 Jan-10 Jan-12 Jan-14 Jan-16 Jan-18 Active Jenkins Git Plugin Installations 0 2000 4000 6000 8000 10000 12000 14000 Jan-08 Jan-10 Jan-12 Jan-14 Jan-16 Jan-18 Jenkins Git Plugin lines of code vs. test LOC LOC Test LOC • Regressions are less frequent • Discover user needs by delivering • Test automation prevents many regressions • Interactive testing still finds most bugs • Feature and dependency growth is increasing the cost of testing
  20. 20. WHEN CAN I SKIP TESTS? Tests are not as critical if: • Code will be discarded • Failures are easy to detect • Interactive testing is enough • Risk is low from broken code
  21. 21. WHEN SHOULD I ADD TESTS? Tests are more critical if: • Code will live a long time • Failures are hard to detect • Interactive testing is not enough • Risk is high from broken code

×