Evergreen build

641 views

Published on

Presentation given at XP Days Ukraine December 2011

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

No Downloads
Views
Total views
641
On SlideShare
0
From Embeds
0
Number of Embeds
215
Actions
Shares
0
Downloads
5
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Evergreen build

  1. 1. Evergreen Build <ul><li>Dima Kovalenko </li></ul>
  2. 2. About me <ul><li>Likes cheese </li></ul><ul><li>@dimacus </li></ul><ul><li>www.agilesoftwaretesting.com </li></ul>
  3. 3. Where I worked
  4. 4. Where I work <ul><li>www.groupon.ru </li></ul>
  5. 5. Why am I here
  6. 6. Why am I here
  7. 7. Why am I here
  8. 8. Why am I here <ul><li>Green build </li></ul><ul><li>Auto merge </li></ul><ul><li>Auto revert </li></ul>
  9. 9. <ul><li>Why have automated tests? </li></ul><ul><li>Expensive </li></ul>
  10. 10. Expensive
  11. 11. Why have automated tests? <ul><li>Expensive </li></ul><ul><li>A lot of work </li></ul>
  12. 12. Why have automated tests? <ul><li>Expensive </li></ul><ul><li>A lot of work </li></ul><ul><li>Always breaking </li></ul>
  13. 13. Always breaking
  14. 14. Why have automated tests? <ul><li>Expensive </li></ul><ul><li>A lot of work </li></ul><ul><li>Always breaking </li></ul><ul><li>Cannot make money from them </li></ul>
  15. 15. Advantages of green build <ul><li>A healthy way of life </li></ul>
  16. 17. Advantages of green build <ul><li>A healthy way of life </li></ul><ul><li>Confidence in the code base </li></ul>
  17. 18. Advantages of green build <ul><li>A healthy way of life </li></ul><ul><li>Confidence in the code base </li></ul><ul><li>Release new features faster </li></ul>
  18. 19. Advantages of green build <ul><li>EASY TO SEE WHEN THINGS GO WRONG!! </li></ul>
  19. 21. Quick Overview <ul><li>Test Driven Development (TDD) </li></ul><ul><li>Continuos Integration (CI) </li></ul><ul><li>Trunk Based Development (TBD) </li></ul><ul><li>Continuos Deployment </li></ul>
  20. 22. Continuos Deployment <ul><li>http://bit.ly/OxJv </li></ul>
  21. 23. “YES!” <ul><li>1 Developer on the team is not enough </li></ul><ul><li>Manager says “we have to” is not enough </li></ul><ul><li>Majority of the team needs to agree to improve </li></ul>
  22. 24. Let’s make the build green <ul><li>Speed </li></ul><ul><li>Always running </li></ul><ul><li>Accurate </li></ul><ul><li>Readable </li></ul><ul><li>Reject broken build </li></ul>
  23. 25. Speed <ul><li>10 mins or less </li></ul><ul><li>Parallel Tests </li></ul><ul><li>Split Build </li></ul><ul><li>Ramdisk </li></ul><ul><li>Headless Browser </li></ul>
  24. 26. Parallel Tests <ul><li>Most modern computers can run more then 1 test at the time </li></ul><ul><li>Many tools </li></ul><ul><li>parallel_tests (github) </li></ul>
  25. 27. Simple Parallel test_groups = [ &quot;group 1&quot; , &quot;group 2&quot; , &quot;group 3&quot; ] Parallel .map(test_groups) do | parallel_build | run_test parallel_build end
  26. 28. Our Tests <ul><li>Cucumber: 300 </li></ul><ul><li>Selenium: 170 </li></ul><ul><li>Rspec: 14,110 </li></ul>
  27. 29. <ul><li>Cucumber: 8 Parallel </li></ul><ul><li>RSpec: 21 Parallel </li></ul><ul><li>Selenium: 10 Parallel </li></ul>
  28. 30. Use more computers <ul><li>Run each group, on a different computer in parallel (Double parallel) </li></ul><ul><li>Split into smaller groups if computers are slow </li></ul>
  29. 32. Jenkins Conductor
  30. 34. Jenkins Conductor <ul><li>http://bit.ly/tF8E5c </li></ul>
  31. 35. Google’s Idea <ul><li>Run the tests that only apply to current module </li></ul><ul><li>If test fail, they fail super fast </li></ul><ul><li>Always run the whole suite right after </li></ul><ul><li>http://bit.ly/jUBirG </li></ul>
  32. 38. RAMdisk <ul><li>Faster then Hard Disk </li></ul><ul><li>Faster then SSD (Wikipedia) </li></ul>
  33. 40. Headless Browser <ul><li>Webrat </li></ul><ul><li>Mechanize </li></ul><ul><li>Firefox </li></ul><ul><li>Capybara-Webkit </li></ul>
  34. 42. Capybara-Webkit <ul><li>http://bit.ly/o0tHp1 </li></ul><ul><li>Biggest boost if only testing Javascript </li></ul><ul><li>Database prevented us from using it </li></ul>
  35. 43. Reliability <ul><li>Flaky tests </li></ul><ul><li>Test dependencies </li></ul><ul><li>Test pollution </li></ul>
  36. 44. Flaky Test <ul><li>Worse then no test at all </li></ul><ul><li>Make you lose confidence in build </li></ul><ul><li>Most noticeable on Selenium </li></ul><ul><li>Run multiple times in row to debug </li></ul>
  37. 45. Selenium Tips <ul><li>Use element IDs to click on </li></ul><ul><li>Check element exists before clicking </li></ul><ul><li>Wait for AJAX to load </li></ul>
  38. 46. Test the test for i in {1..20}; do run_test; done
  39. 47. Accurate <ul><li>Test fails when it should </li></ul><ul><li>Test passes when it should </li></ul><ul><li>Test actually tests something </li></ul>
  40. 48. Readable <ul><li>Cucumber </li></ul><ul><li>Rspec </li></ul><ul><li>Keep them clean </li></ul>
  41. 49. Reject broken build <ul><li>Groupon setup </li></ul><ul><ul><li>Master </li></ul></ul><ul><ul><li>Release </li></ul></ul><ul><ul><li>Any-Branch </li></ul></ul>
  42. 50. Any-Branch <ul><li>Test </li></ul><ul><li>Merge/Rebase </li></ul>
  43. 51. Test <ul><li>New Branch </li></ul><ul><li>Has to start with test/..... </li></ul><ul><li>Can choose to run only a single item </li></ul>
  44. 57. Merge/Rebase <ul><li>Starts with merge/... or rebase/... </li></ul><ul><li>If tests fail, ignore </li></ul><ul><li>If tests pass, merge into master </li></ul>
  45. 65. Questions?

×