Loading…

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

Like this presentation? Why not share!

Like this? Share it with your network

Share

soft-shake.ch - Let's make this test suite run faster

on

  • 1,093 views

David Gageot ...

David Gageot

The more the tests, the longer the build. And when the build gets longer, the bugs take longer to fix, the features take longer to deploy. Every build should be minutes long, all tests included.
Now lets say, our test suite takes much longer than that. How to reduce its duration? Where to start?
Making tests become useless, converting functional tests to unit tests, running tests in parallel, building projects in parallel, doing slow tasks only once, writing fast DBMS tests... Let's share dozens of tips to fasten you test suite A LOT.

Statistics

Views

Total Views
1,093
Views on SlideShare
1,093
Embed Views
0

Actions

Likes
0
Downloads
6
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

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.

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

soft-shake.ch - Let's make this test suite run faster Presentation Transcript

  • 1. 2010 Let's make this test suite run faster David Gageot J6
  • 2. Programme de la Conférence www.soft-shake.ch Agilité iPhone Java Incubateur 8:15 Accueil des participants 8:40 Mot des organisateurs & Criée des orateurs 9:00 Keynote de Nicolas Martignole (30 minutes) 9:40 - A1 - - I1- - J1 - - X1 - Le terrain Agile Hello iPhone NOSQL also means RDF stores: an Le développement durable Android case study 10:40 Jean-Philippe Vigniel Stephane Tavera Fabrizio Giudci Dominic Williams 11:00 - A2 - - I2 - - J2 - - X2 - Integration of User Centered Design Développement d'une application La Tequila du développement Web Cloud Computing: anatomie et in Agile Development of RIA iPhone pilotée par les tests pratique 12:00 J. Borkenhagen, J. Desmazières Emmanuel Etasse, Van-Charles Tran Nicolas Martignole Marc-Elian Bégin 12:20 - A3 - - I3 - - J3 - - X3 - Adoption de l'Agilité par les usages Distribution d'applications iPhone Vaadin - Rich Web Applications in Les DVCS sont vos amis en Entreprise: Réalisation d'un Server-side Java without Plug-ins or Xavier Warzee AppStore interne JavaScript Sébastien Douche 13:20 Géraud de Laval Joonas Lehtinen Pause repas (50 minutes) 14h10 Keynote de Regis Medina (30 minutes) 14h50 - A4 - - I4 - - J4 - - X4 - Scrum, introduction et mise en Agile iOS Development JAX-RS and Java EE 6 IT Design & Ergonomy oeuvre avec iceScrum 15h50 Claude Aubry Jérôme Layat, Alexander Osterwalder Paul Sandoz Pascal Petit, Aude Lussigny 16h10 - A5 - - I5 - - J5 - - X5 - Agilité : 10 ans déjà Optimizing iOS applications Ecrivez et automatisez vos tests NoSQL : Enfin de la biodiversité fonctionnels avec jBehave dans l'écosystème des BD 17h10 Thierry Cros Marc-Antoine Scheurer Xavier Bourguignon Olivier Mallassi 17h30 - A6 - - I6 - - J6 - - X6 - Lean engineering iPhone et Agile, l'amour vache Let's make this test suite run faster The feel of Scala 18h30 Jean-Christophe Dubail Guillaume Duquesnay David Gageot Mario Fusco Mot de la fin & tombola
  • 3. Let's make this test suite run faster!
  • 4. Let's make this test suite run faster! Why? What for ? http://farm1.static.flickr.com/158/349497988_fb751a5e3a_z.jpg
  • 5. You test early and often Don’t you? http://farm1.static.flickr.com/97/246816211_573c2901e1_z.jpg?zz=1
  • 6. Continuous integration, continuous testing... ...even continuous deployment http://vator.tv/images/attachments/150609195630ctd.gif
  • 7. Testing often Often means waiting a lot http://farm3.static.flickr.com/2505/3772118924_11fe195ef1.jpg
  • 8. Your coding room doesn’t have to look like this What for ? http://upload.wikimedia.org/wikipedia/commons/3/3f/ Nespresso_boutique.JPG
  • 9. Tests can be fast Even if lines of code keep growing
  • 10. Easy! Let’s distribute across multiple hudson servers
  • 11. It doesn’t have to be complicated I’ll share a few simple tricks
  • 12. It can make your product better Simple to test, means simple to write, deploy and USE Photo: http://www.flickr.com/photos/zoutedrop/2317065892/
  • 13. How can we accelerate the tests? The Cheater The Lazy The Brave http://all-the-movies.cowblog.fr/images/arton1122.jpg
  • 14. The Cheater The Lazy The Brave http://all-the-movies.cowblog.fr/images/arton1122.jpg
  • 15. Buy a faster machine Tests are cpu/memory bound http://farm1.static.flickr.com/28/93569705_1c562b413a_z.jpg?zz=1
  • 16. Be warned Single threaded tests get slower over time 100 75 50 25 0 2007 2008 2009 2010 http://farm5.static.flickr.com/4096/4819945812_735744e0fc_z.jpg
  • 17. Use all the cores parallel build with maven3 mvn -T1 clean install : 5:05s mvn -T4 clean install : 3:10s
  • 18. Use all the cores parallel build with maven3
  • 19. Use all the cores For JUnit/TestNG tests .
  • 20. The Cheater The Lazy The Brave http://all-the-movies.cowblog.fr/images/arton1122.jpg
  • 21. Delete redundant tests It’s so simple, we don’t do it... http://geekandpoke.typepad.com/geekandpoke/images/2008/04/24/ turingtest.jpg
  • 22. Even better, delete dead code To delete yet other useless tests http://farm1.static.flickr.com/58/191393602_3d9b643ab0_z.jpg
  • 23. Work in a sandbox The network is too slow In-memory database: H2 Behaves more like MySql than Hsqldb
  • 24. It’s Not only SQL If going with NoSQL, take a server that can run in-process eg. Voldemort
  • 25. In-memory SMTP Server Ethereal
  • 26. Everything local and in-memory Files Apache VFS (Virtual File System) Spring Resource... As a bonus, tests will run smoother .
  • 27. The Cheater The Lazy The Brave http://all-the-movies.cowblog.fr/images/arton1122.jpg
  • 28. Don’t test business rules in integration tests Unit tests is often a better place http://upload.wikimedia.org/wikipedia/commons/b/bd/ Contortionist_Ravi_standing.jpg
  • 29. 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
  • 30. Take the longer integration test Break it in one faster integration test and a lot of small unit tests http://farm2.static.flickr.com/1168/3166709586_96f9a3fd95.jpg
  • 31. Or mock the slowest layers eg. functional test with Spring and Mockito
  • 32. Or mock the slowest layers eg. functional test with Spring and Mockito Mocks are not just for unit tests
  • 33. 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: http://www.flickr.com/photos/zoutedrop/2317065892/
  • 34. Really ? http://i.zdnet.com/blogs/complexity-and-false-hope.jpg
  • 35. Complexity has a cost That you pay each time a test runs http://thehongkongfixereng.files.wordpress.com/2008/07/couteau-suisse.jpg
  • 36. Test through the browser the strict minimal Use javascript unit tests for the rest http://farm2.static.flickr.com/1168/3166709586_96f9a3fd95.jpg
  • 37. I tend to be old school And write server-side code most of the time http://www.celebridiot.com/wp-content/uploads/2009/06/ rick_astley_death_hoax.jpg
  • 38. One more thing... Simplify and optimize your code Tests will run faster .
  • 39. Thank you Q/A
  • 40. Who am I? David Gageot CTO algodeal.com The Crowd Sourced Quant Hedge Fund @dgageot javabien.net