SlideShare a Scribd company logo
1 of 38
Download to read offline
Let's make this test suite run faster!




Paris Java User Group
www.parisjug.org
Copyright(c) 2010 Paris JUG, Licence CC-Creatives Commons 2.0 France - Paternité - Pas d’utilisation commerciale - Partage des Conditions à l’identique
Let's make this test suite run faster!
               Why?




             What for ?




                                  http://farm1.static.flickr.com/158/349497988_fb751a5e3a_z.jpg
You test early and often
      Don’t you?




                           http://farm1.static.flickr.com/97/246816211_573c2901e1_z.jpg?zz=1
Continuous integration, continuous testing...
      ...even continuous deployment




                                      http://vator.tv/images/attachments/150609195630ctd.gif
Testing often
Often means waiting a lot




                            http://farm3.static.flickr.com/2505/3772118924_11fe195ef1.jpg
Your coding room doesn’t have to look like this




                  What for ?




                                        http://upload.wikimedia.org/wikipedia/commons/3/3f/
                                                                     Nespresso_boutique.JPG
Tests can be fast
Even if lines of code keep growing
Easy!
Let’s distribute across multiple hudson servers
It doesn’t have to be complicated
    I’ll share a few simple tricks
It can make your product better
Simple to test, means simple to write, deploy and USE




                                         Photo: http://www.flickr.com/photos/zoutedrop/2317065892/
How can we accelerate the tests?



     The Cheater
     The Lazy
     The Brave




                                   http://all-the-movies.cowblog.fr/images/arton1122.jpg
The Cheater
The Lazy
The Brave




              http://all-the-movies.cowblog.fr/images/arton1122.jpg
Buy a faster machine
Tests are cpu/memory bound




                         http://farm1.static.flickr.com/28/93569705_1c562b413a_z.jpg?zz=1
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
Use all the cores
parallel build with maven3




mvn -T1 clean install : 5:05s
mvn -T4 clean install : 3:10s
Use all the cores
parallel build with maven3
Use all the cores
Surefire 2.7.1 For JUnit/TestNG tests




                                       .
The Cheater
The Lazy
The Brave




              http://all-the-movies.cowblog.fr/images/arton1122.jpg
Delete redundant tests
It’s so simple, we don’t do it...




                               http://geekandpoke.typepad.com/geekandpoke/images/2008/04/24/
                                                                                turingtest.jpg
Even better, delete dead code
To delete yet other useless tests




                                http://farm1.static.flickr.com/58/191393602_3d9b643ab0_z.jpg
Work in a sandbox
       The network is too slow


     In-memory database: H2




Behaves more like MySql than Hsqldb
It’s Not only SQL




If going with NoSQL, take a server that
          can run in-process

            eg. Voldemort
In-memory SMTP Server
    SubEtha SMTP
Everything local and in-memory
              Files




Apache VFS (Virtual File System)
      Spring Resource...




                    As a bonus, tests will
                    run smoother
                                             .
The Cheater
The Lazy
The Brave




              http://all-the-movies.cowblog.fr/images/arton1122.jpg
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
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
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
Or mock the slowest layers
eg. functional test with Spring and Mockito




                                        Mocks are
                                        not just for
                                         unit tests
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/
Really ?




           http://i.zdnet.com/blogs/complexity-and-false-hope.jpg
Complexity has a cost
That you pay each time a test runs




                             http://thehongkongfixereng.files.wordpress.com/2008/07/couteau-suisse.jpg
Test through the browser the strict minimal
     Use javascript unit tests for the rest




                                   http://farm2.static.flickr.com/1168/3166709586_96f9a3fd95.jpg
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
One more thing...




Simplify and optimize your code

      Tests will run faster




                                  .
Thank you
   Q/A
www.parisjug.org
Copyright(c) 2010 Paris JUG, Licence CC-Creatives Commons 2.0 France - Paternité - Pas d’utilisation commerciale - Partage des Conditions à l’identique

More Related Content

What's hot (11)

Django strategy-test
Django strategy-testDjango strategy-test
Django strategy-test
 
Drupal 7 ci and testing
Drupal 7 ci and testingDrupal 7 ci and testing
Drupal 7 ci and testing
 
Http
HttpHttp
Http
 
Try harder or go home
Try harder or go homeTry harder or go home
Try harder or go home
 
Selenium
SeleniumSelenium
Selenium
 
Advanced Jasmine
Advanced JasmineAdvanced Jasmine
Advanced Jasmine
 
Automating Software Releases (Dallas/Ft. Worth Perl Mongers 2004)
Automating Software Releases (Dallas/Ft. Worth Perl Mongers 2004)Automating Software Releases (Dallas/Ft. Worth Perl Mongers 2004)
Automating Software Releases (Dallas/Ft. Worth Perl Mongers 2004)
 
Os Ramirez
Os RamirezOs Ramirez
Os Ramirez
 
How the JDeveloper team test JDeveloper at UKOUG'08
How the JDeveloper team test JDeveloper at UKOUG'08How the JDeveloper team test JDeveloper at UKOUG'08
How the JDeveloper team test JDeveloper at UKOUG'08
 
DjangoCon 2013 - How to Write Fast and Efficient Unit Tests in Django
DjangoCon 2013 - How to Write Fast and Efficient Unit Tests in DjangoDjangoCon 2013 - How to Write Fast and Efficient Unit Tests in Django
DjangoCon 2013 - How to Write Fast and Efficient Unit Tests in Django
 
Managing Modules Without Going Crazy (NPW 2007)
Managing Modules Without Going Crazy (NPW 2007)Managing Modules Without Going Crazy (NPW 2007)
Managing Modules Without Going Crazy (NPW 2007)
 

Viewers also liked

Git Tours JUG 2010
Git Tours JUG 2010Git Tours JUG 2010
Git Tours JUG 2010
David Gageot
 
Le Facilitateur, un role encore meconnu
Le Facilitateur, un role encore meconnuLe Facilitateur, un role encore meconnu
Le Facilitateur, un role encore meconnu
David Gageot
 

Viewers also liked (6)

Let's make this test suite run faster! SoftShake 2010
Let's make this test suite run faster! SoftShake 2010Let's make this test suite run faster! SoftShake 2010
Let's make this test suite run faster! SoftShake 2010
 
Parcours Facilitateur professionnel de dynamiques collaboratives
Parcours Facilitateur professionnel de dynamiques collaborativesParcours Facilitateur professionnel de dynamiques collaboratives
Parcours Facilitateur professionnel de dynamiques collaboratives
 
Git USI 2010
Git USI 2010Git USI 2010
Git USI 2010
 
Git Tours JUG 2010
Git Tours JUG 2010Git Tours JUG 2010
Git Tours JUG 2010
 
Git Agile France 2010
Git Agile France 2010Git Agile France 2010
Git Agile France 2010
 
Le Facilitateur, un role encore meconnu
Le Facilitateur, un role encore meconnuLe Facilitateur, un role encore meconnu
Le Facilitateur, un role encore meconnu
 

Similar to Let's make this test suite run faster - Paris JUG 2011

Comment j'ai mis ma suite de tests au régime en 5 minutes par jour
Comment j'ai mis ma suite de tests au régime en 5 minutes par jourComment j'ai mis ma suite de tests au régime en 5 minutes par jour
Comment j'ai mis ma suite de tests au régime en 5 minutes par jour
CARA_Lyon
 
Csdn Drdobbs Tenni Theurer Yahoo
Csdn Drdobbs Tenni Theurer YahooCsdn Drdobbs Tenni Theurer Yahoo
Csdn Drdobbs Tenni Theurer Yahoo
guestb1b95b
 
2012 04-19 theory-of_operation
2012 04-19 theory-of_operation2012 04-19 theory-of_operation
2012 04-19 theory-of_operation
bobwolff68
 
Hands On, Duchess 10/17/2012
Hands On, Duchess 10/17/2012Hands On, Duchess 10/17/2012
Hands On, Duchess 10/17/2012
slandelle
 
Gatling - JUGL, 2012-09-13
Gatling  - JUGL, 2012-09-13Gatling  - JUGL, 2012-09-13
Gatling - JUGL, 2012-09-13
Nicolas Rémond
 
Joomla! Day Poland 2012 - Active Security for Joomla! sites
Joomla! Day Poland 2012 - Active Security for Joomla! sitesJoomla! Day Poland 2012 - Active Security for Joomla! sites
Joomla! Day Poland 2012 - Active Security for Joomla! sites
Nicholas Dionysopoulos
 
Framework and Application Benchmarking
Framework and Application BenchmarkingFramework and Application Benchmarking
Framework and Application Benchmarking
Paul Jones
 

Similar to Let's make this test suite run faster - Paris JUG 2011 (20)

Comment j'ai mis ma suite de tests au régime en 5 minutes par jour
Comment j'ai mis ma suite de tests au régime en 5 minutes par jourComment j'ai mis ma suite de tests au régime en 5 minutes par jour
Comment j'ai mis ma suite de tests au régime en 5 minutes par jour
 
Continuous Integration Testing in Django
Continuous Integration Testing in DjangoContinuous Integration Testing in Django
Continuous Integration Testing in Django
 
Agility Requires Safety
Agility Requires SafetyAgility Requires Safety
Agility Requires Safety
 
Csdn Drdobbs Tenni Theurer Yahoo
Csdn Drdobbs Tenni Theurer YahooCsdn Drdobbs Tenni Theurer Yahoo
Csdn Drdobbs Tenni Theurer Yahoo
 
WebTest - Efficient Functional Web Testing with HtmlUnit and Beyond
WebTest - Efficient Functional Web Testing with HtmlUnit and BeyondWebTest - Efficient Functional Web Testing with HtmlUnit and Beyond
WebTest - Efficient Functional Web Testing with HtmlUnit and Beyond
 
Distributed Systems at Scale: Reducing the Fail
Distributed Systems at Scale:  Reducing the FailDistributed Systems at Scale:  Reducing the Fail
Distributed Systems at Scale: Reducing the Fail
 
Load testing with vs 2013
Load testing with vs 2013Load testing with vs 2013
Load testing with vs 2013
 
Testing w-mocks
Testing w-mocksTesting w-mocks
Testing w-mocks
 
Browser Automated Testing Frameworks - Nightwatch.js
Browser Automated Testing Frameworks - Nightwatch.jsBrowser Automated Testing Frameworks - Nightwatch.js
Browser Automated Testing Frameworks - Nightwatch.js
 
2012 04-19 theory-of_operation
2012 04-19 theory-of_operation2012 04-19 theory-of_operation
2012 04-19 theory-of_operation
 
Hands On, Duchess 10/17/2012
Hands On, Duchess 10/17/2012Hands On, Duchess 10/17/2012
Hands On, Duchess 10/17/2012
 
Containerize your Blackbox tests
Containerize your Blackbox testsContainerize your Blackbox tests
Containerize your Blackbox tests
 
Gatling - JUGL, 2012-09-13
Gatling  - JUGL, 2012-09-13Gatling  - JUGL, 2012-09-13
Gatling - JUGL, 2012-09-13
 
Concurrency patterns
Concurrency patternsConcurrency patterns
Concurrency patterns
 
Workshop: Functional testing made easy with PHPUnit & Selenium (phpCE Poland,...
Workshop: Functional testing made easy with PHPUnit & Selenium (phpCE Poland,...Workshop: Functional testing made easy with PHPUnit & Selenium (phpCE Poland,...
Workshop: Functional testing made easy with PHPUnit & Selenium (phpCE Poland,...
 
Joomla! Day Poland 2012 - Active Security for Joomla! sites
Joomla! Day Poland 2012 - Active Security for Joomla! sitesJoomla! Day Poland 2012 - Active Security for Joomla! sites
Joomla! Day Poland 2012 - Active Security for Joomla! sites
 
Framework and Application Benchmarking
Framework and Application BenchmarkingFramework and Application Benchmarking
Framework and Application Benchmarking
 
Lessons Learned in Software Development: QA Infrastructure – Maintaining Rob...
Lessons Learned in Software Development: QA Infrastructure – Maintaining Rob...Lessons Learned in Software Development: QA Infrastructure – Maintaining Rob...
Lessons Learned in Software Development: QA Infrastructure – Maintaining Rob...
 
Performance - a challenging craft
Performance  - a challenging craftPerformance  - a challenging craft
Performance - a challenging craft
 
Stop Being Lazy and Test Your Software
Stop Being Lazy and Test Your SoftwareStop Being Lazy and Test Your Software
Stop Being Lazy and Test Your Software
 

Recently uploaded

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Recently uploaded (20)

Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 

Let's make this test suite run faster - Paris JUG 2011

  • 1. Let's make this test suite run faster! Paris Java User Group
  • 2. www.parisjug.org Copyright(c) 2010 Paris JUG, Licence CC-Creatives Commons 2.0 France - Paternité - Pas d’utilisation commerciale - Partage des Conditions à l’identique
  • 3. Let's make this test suite run faster! Why? What for ? http://farm1.static.flickr.com/158/349497988_fb751a5e3a_z.jpg
  • 4. You test early and often Don’t you? http://farm1.static.flickr.com/97/246816211_573c2901e1_z.jpg?zz=1
  • 5. Continuous integration, continuous testing... ...even continuous deployment http://vator.tv/images/attachments/150609195630ctd.gif
  • 6. Testing often Often means waiting a lot http://farm3.static.flickr.com/2505/3772118924_11fe195ef1.jpg
  • 7. Your coding room doesn’t have to look like this What for ? http://upload.wikimedia.org/wikipedia/commons/3/3f/ Nespresso_boutique.JPG
  • 8. Tests can be fast Even if lines of code keep growing
  • 9. Easy! Let’s distribute across multiple hudson servers
  • 10. It doesn’t have to be complicated I’ll share a few simple tricks
  • 11. It can make your product better Simple to test, means simple to write, deploy and USE Photo: http://www.flickr.com/photos/zoutedrop/2317065892/
  • 12. How can we accelerate the tests? The Cheater The Lazy The Brave http://all-the-movies.cowblog.fr/images/arton1122.jpg
  • 13. The Cheater The Lazy The Brave http://all-the-movies.cowblog.fr/images/arton1122.jpg
  • 14. Buy a faster machine Tests are cpu/memory bound http://farm1.static.flickr.com/28/93569705_1c562b413a_z.jpg?zz=1
  • 15. 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
  • 16. Use all the cores parallel build with maven3 mvn -T1 clean install : 5:05s mvn -T4 clean install : 3:10s
  • 17. Use all the cores parallel build with maven3
  • 18. Use all the cores Surefire 2.7.1 For JUnit/TestNG tests .
  • 19. The Cheater The Lazy The Brave http://all-the-movies.cowblog.fr/images/arton1122.jpg
  • 20. Delete redundant tests It’s so simple, we don’t do it... http://geekandpoke.typepad.com/geekandpoke/images/2008/04/24/ turingtest.jpg
  • 21. Even better, delete dead code To delete yet other useless tests http://farm1.static.flickr.com/58/191393602_3d9b643ab0_z.jpg
  • 22. Work in a sandbox The network is too slow In-memory database: H2 Behaves more like MySql than Hsqldb
  • 23. It’s Not only SQL If going with NoSQL, take a server that can run in-process eg. Voldemort
  • 24. In-memory SMTP Server SubEtha SMTP
  • 25. Everything local and in-memory Files Apache VFS (Virtual File System) Spring Resource... As a bonus, tests will run smoother .
  • 26. The Cheater The Lazy The Brave http://all-the-movies.cowblog.fr/images/arton1122.jpg
  • 27. 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
  • 28. 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
  • 29. 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
  • 30. Or mock the slowest layers eg. functional test with Spring and Mockito Mocks are not just for unit tests
  • 31. 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/
  • 32. Really ? http://i.zdnet.com/blogs/complexity-and-false-hope.jpg
  • 33. Complexity has a cost That you pay each time a test runs http://thehongkongfixereng.files.wordpress.com/2008/07/couteau-suisse.jpg
  • 34. Test through the browser the strict minimal Use javascript unit tests for the rest http://farm2.static.flickr.com/1168/3166709586_96f9a3fd95.jpg
  • 35. 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
  • 36. One more thing... Simplify and optimize your code Tests will run faster .
  • 37. Thank you Q/A
  • 38. www.parisjug.org Copyright(c) 2010 Paris JUG, Licence CC-Creatives Commons 2.0 France - Paternité - Pas d’utilisation commerciale - Partage des Conditions à l’identique