Comment j'ai mis ma suite de tests au régime en 5 minutes par jour
Upcoming SlideShare
Loading in...5

Like this? Share it with your network


Comment j'ai mis ma suite de tests au régime en 5 minutes par jour



David gageot @Mix-IT 2011

David gageot @Mix-IT 2011



Total Views
Views on SlideShare
Embed Views



4 Embeds 949 942
url_unknown 3 3 1



Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment

Comment j'ai mis ma suite de tests au régime en 5 minutes par jour Presentation Transcript

  • 1. Lets make this test suiterun faster!David GageotCTO Algodeal Twitter: Blog:
  • 2. Lets make this test suite run faster! Why? What for ?
  • 3. You test early and often Don’t you?
  • 4. Continuous integration, continuous testing... ...even continuous deployment
  • 5. Testing oftenOften means waiting a lot
  • 6. Your coding room doesn’t have to look like this What for ? Nespresso_boutique.JPG
  • 7. Tests can be fastEven if lines of code keep growing
  • 8. Easy!Let’s distribute across multiple hudson servers
  • 9. It doesn’t have to be complicated I’ll share a few simple tricks
  • 10. It can make your product betterSimple to test, means simple to write, deploy and USE Photo:
  • 11. How can we accelerate the tests? The Cheater The Lazy The Brave
  • 12. The CheaterThe LazyThe Brave
  • 13. Buy a faster machineTests are cpu/memory bound
  • 14. Be warnedSingle threaded tests get slower over time 100 75 50 25 0 2007 2008 2009 2010
  • 15. Use all the cores parallel build with maven3mvn -T1 clean install : 5:05smvn -T4 clean install : 3:10s
  • 16. Use all the coresparallel build with maven3
  • 17. Use all the coresSurefire 2.7.1 For JUnit/TestNG tests .
  • 18. The CheaterThe LazyThe Brave
  • 19. Delete redundant testsIt’s so simple, we don’t do it... turingtest.jpg
  • 20. Even better, delete dead codeTo delete yet other useless tests
  • 21. Work in a sandbox The network is too slow In-memory database: H2Behaves more like MySql than Hsqldb
  • 22. It’s Not only SQLIf going with NoSQL, take a server that can run in-process eg.Voldemort
  • 23. In-memory SMTP Server SubEtha SMTP
  • 24. Everything local and in-memory FilesApache VFS (Virtual File System) Spring Resource... As a bonus, tests will run smoother .
  • 25. The CheaterThe LazyThe Brave
  • 26. Don’t test business rules in integration tests Unit tests is often a better place Contortionist_Ravi_standing.jpg
  • 27. Don’t test business rules in integration tests Unit tests is often a better place Functional test (on a web page) 10s Unit test 0.01s
  • 28. Take the longer integration testBreak it in one faster integration test and a lot of small unit tests
  • 29. Or mock the slowest layerseg. functional test with Spring and Mockito Mocks are not just for unit tests
  • 30. Don’t test through the browser Selenium is often overkill «But my application is complex!» «My users want complex features, My users want Ajax» «I need to test browser compatibility!» Photo:
  • 31. Really ?
  • 32. Complexity has a costThat you pay each time a test runs
  • 33. Test through the browser the strict minimal Use javascript unit tests for the rest
  • 34. I tend to be old schoolAnd write server-side code most of the time rick_astley_death_hoax.jpg
  • 35. One more thing...Simplify and optimize your code Tests will run faster .
  • 36. MerciDes questions ?