SlideShare une entreprise Scribd logo
1  sur  49
Télécharger pour lire hors ligne
Let's  make  this  test  suite  
        run  faster!
David	
  Gageot

 Freelance
 developer

 @dgageot
javabien.net
Why  make  a  test  suite  run  faster?
“   I   firmly   believe   it   can   make   your  
product   beBer.   Faster   to   test   leads  
to  faster  to  write,  deploy  and  use  ”
                      Anonymous  bearded  freelance  developper
You  test  early  and  oHen.  Right?
ConKnuous  integraKon?
ConKnuous  tesKng?
ConKnuous  deployment?
TesKng  a  lot  can  lead  to  waiKng  a  lot
How  wants  his  coding  room  to  look  like  this
Test  suite  duraKon  can  be  contained
Jenkins  slaves  to  the  rescue
Jenkins  slaves  to  the  rescue.  not.
Why  complicated  when  it  can  be  simple?
I’ll  share  a  few  easy  tricks
“   I   firmly   believe   it   can   make   your  
product   beBer.   Faster   to   test   leads  
to  faster  to  write,  deploy  and  use  ”
                      Anonymous  bearded  freelance  developper
How  can  we  accelerate  the  tests?



      The Cheater
      The Lazy
      The Brave
The Cheater
Buy  a  faster  machine.  Tests  are  cpu/memory  bound
Thank  you
   Q/A
BUT  single  threaded  tests  get  slower  over  Kme

    100



     75



     50



     25



      0
           2007      2008     2009      2010
Use  all  the  cores  with  Maven3




 mvn  -­‐T1  clean  install  :  5:05s
 mvn  -­‐T4  clean  install  :  3:10s



                                          Beware of
                                        tests with side
                                            effects
It’s  not  just  me
Use  all  the  cores  with  JUnit/TestNG




                                       Beware of
                                     tests with side
                                         effects
That’s  it  for  cheaters
  No  silver  bullet
The Lazy
Delete  useless  tests
It’s	
  so	
  simple,	
  we	
  don’t	
  do	
  it...
Even  beBer,  delete  dead  code
Even  beBer,  delete  dead  code
Leads	
  to	
  dele:ng	
  even	
  more	
  useless	
  tests
Work  in  a  sandbox
                   The	
  database	
  is	
  slow




In-­‐memory	
  database	
  H2	
  behaves	
  much	
  like	
  MySql


                                                         As simple as
                                                         changing an
                                                           xml file
It’s  Not  only  SQL
               The	
  network	
  is	
  slow




If	
  going	
  for	
  NoSQL,	
  choose	
  a	
  server	
  that
                  can	
  run	
  in-­‐process

                   eg.	
  Voldemort
In-­‐memory  SMTP  Server




                    SubEtha	
  SMTP
Abstract  the  filesystem




Apache	
  VFS	
  (Virtual	
  File	
  System)
      Spring	
  Resource...
In-­‐memory  everything



              As  a  bonus,  tests  will  
              run  smoother
Of  course  all  of  these  are  easier  to  setup  
       at  the  beginning  of  a  project
The Brave
5  minutes  a  day  can  make  a  difference
Don’t  test  business  rules  in  integraKon  tests
         Unit	
  tests	
  are	
  oPen	
  a	
  beQer	
  place
Not  the  same  scale  of  speed

                          10sec




                                   .01sec
AcKon  #1  -­‐  Break  the  longer  integraKon  test
Into	
  one	
  faster	
  integra:on	
  test	
  and	
  a	
  lot	
  of	
  small	
  unit	
  tests
AcKon  #2  -­‐  Mock  the  slowest  layers
    eg.	
  with	
  Spring	
  and	
  Mockito	
  spies




                                                       Mocks are
                                                       not just for
                                                        unit tests
AcKon  #3  -­‐  Don’t  test  through  the  browser
            Selenium	
  is	
  oPen	
  overkill


                              «But	
  my	
  applica:on	
  is	
  
                                      complex!»

                            «My	
  users	
  want	
  complex	
  
                                      features,
                             My	
  users	
  want	
  Ajax»

                             «I	
  need	
  to	
  test	
  browser	
  
                                    compa:bility!»
Really?
Complexity  has  a  cost
That	
  you	
  pay	
  each	
  :me	
  tests	
  run
Test  through  the  browser  the  strict  minimal
               Unit	
  test	
  Javascript
AcKon  #4  -­‐  SomeKmes  be  old  school
  write	
  (easier	
  to	
  test)	
  server-­‐side	
  code
Thank  you
   Q/A
One  more  thing™




Ac:on	
  #0	
  -­‐	
  Simplify	
  and	
  op:mize	
  your	
  code

                 Tests	
  will	
  run	
  faster



                                                           Keep that one
                                                             secret...
Thank  you
   Q/A

Contenu connexe

Tendances

Django strategy-test
Django strategy-testDjango strategy-test
Django strategy-test
Royce Haynes
 
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)
brian d foy
 
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
Casey Kinsey
 

Tendances (18)

Docker security configuration
Docker security configurationDocker security configuration
Docker security configuration
 
Cache is King
Cache is KingCache is King
Cache is King
 
你不知道的前端
你不知道的前端你不知道的前端
你不知道的前端
 
Advanced Jasmine
Advanced JasmineAdvanced Jasmine
Advanced Jasmine
 
Node.js in Production
Node.js in ProductionNode.js in Production
Node.js in Production
 
Django strategy-test
Django strategy-testDjango strategy-test
Django strategy-test
 
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
 
Automation With Selenium
Automation With SeleniumAutomation With Selenium
Automation With Selenium
 
A Very Biased Comparison of MVC Libraries
A Very Biased Comparison of MVC LibrariesA Very Biased Comparison of MVC Libraries
A Very Biased Comparison of MVC Libraries
 
Drupal 7 ci and testing
Drupal 7 ci and testingDrupal 7 ci and testing
Drupal 7 ci and testing
 
Website qa
Website qaWebsite qa
Website qa
 
CascadiaJS 2014 - Making JavaScript Tests Fast, Easy & Friendly
CascadiaJS 2014 - Making JavaScript Tests Fast, Easy & FriendlyCascadiaJS 2014 - Making JavaScript Tests Fast, Easy & Friendly
CascadiaJS 2014 - Making JavaScript Tests Fast, Easy & Friendly
 
Http
HttpHttp
Http
 
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)
 
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)
 
SSL Impersonation in 5 minutes or less!
SSL Impersonation in 5 minutes or less!SSL Impersonation in 5 minutes or less!
SSL Impersonation in 5 minutes or less!
 
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
 
Selenium
SeleniumSelenium
Selenium
 

Similaire à Let's make this test suite run faster

Jenkins Evolutions - JEEConf 2012
Jenkins Evolutions - JEEConf 2012Jenkins Evolutions - JEEConf 2012
Jenkins Evolutions - JEEConf 2012
Anton Arhipov
 
GeeCON 2012 hurdle run through ejb testing
GeeCON 2012 hurdle run through ejb testingGeeCON 2012 hurdle run through ejb testing
GeeCON 2012 hurdle run through ejb testing
Jakub Marchwicki
 

Similaire à Let's make this test suite run faster (20)

Zero to tested
Zero to testedZero to tested
Zero to tested
 
Distributed Testing Environment
Distributed Testing EnvironmentDistributed Testing Environment
Distributed Testing Environment
 
Testing Ember Apps
Testing Ember AppsTesting Ember Apps
Testing Ember Apps
 
Graceful Failure with Selenium and Continuous Integration
Graceful Failure with Selenium and Continuous IntegrationGraceful Failure with Selenium and Continuous Integration
Graceful Failure with Selenium and Continuous Integration
 
Jenkins Evolutions - JEEConf 2012
Jenkins Evolutions - JEEConf 2012Jenkins Evolutions - JEEConf 2012
Jenkins Evolutions - JEEConf 2012
 
Unit testing hippo
Unit testing hippoUnit testing hippo
Unit testing hippo
 
Scala e xchange 2013 haoyi li on metascala a tiny diy jvm
Scala e xchange 2013 haoyi li on metascala a tiny diy jvmScala e xchange 2013 haoyi li on metascala a tiny diy jvm
Scala e xchange 2013 haoyi li on metascala a tiny diy jvm
 
[AWS Dev Day] 실습워크샵 | Amazon EKS 핸즈온 워크샵
 [AWS Dev Day] 실습워크샵 | Amazon EKS 핸즈온 워크샵 [AWS Dev Day] 실습워크샵 | Amazon EKS 핸즈온 워크샵
[AWS Dev Day] 실습워크샵 | Amazon EKS 핸즈온 워크샵
 
TDD in the Web with Python and Django
TDD in the Web with Python and DjangoTDD in the Web with Python and Django
TDD in the Web with Python and Django
 
Yan Cui - Serverless in production, an experience report - Codemotion Milan 2017
Yan Cui - Serverless in production, an experience report - Codemotion Milan 2017Yan Cui - Serverless in production, an experience report - Codemotion Milan 2017
Yan Cui - Serverless in production, an experience report - Codemotion Milan 2017
 
Serverless in production, an experience report (codemotion milan)
Serverless in production, an experience report (codemotion milan)Serverless in production, an experience report (codemotion milan)
Serverless in production, an experience report (codemotion milan)
 
Testing Storm components with Groovy and Spock
Testing Storm components with Groovy and SpockTesting Storm components with Groovy and Spock
Testing Storm components with Groovy and Spock
 
TDD super mondays-june-2014
TDD super mondays-june-2014TDD super mondays-june-2014
TDD super mondays-june-2014
 
SPA 2009 - Acceptance Testing AJAX Web Applications through the GUI
SPA 2009 - Acceptance Testing AJAX Web Applications through the GUISPA 2009 - Acceptance Testing AJAX Web Applications through the GUI
SPA 2009 - Acceptance Testing AJAX Web Applications through the GUI
 
Rethinking Testing
Rethinking TestingRethinking Testing
Rethinking Testing
 
Docker - fast dev faster testing
Docker - fast dev faster testingDocker - fast dev faster testing
Docker - fast dev faster testing
 
GeeCON 2012 hurdle run through ejb testing
GeeCON 2012 hurdle run through ejb testingGeeCON 2012 hurdle run through ejb testing
GeeCON 2012 hurdle run through ejb testing
 
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...
 
Unit testing
Unit testingUnit testing
Unit testing
 
Escaping Automated Test Hell - One Year Later
Escaping Automated Test Hell - One Year LaterEscaping Automated Test Hell - One Year Later
Escaping Automated Test Hell - One Year Later
 

Plus de David Gageot

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
 

Plus de David Gageot (6)

Git Tours JUG 2010
Git Tours JUG 2010Git Tours JUG 2010
Git Tours JUG 2010
 
Git USI 2010
Git USI 2010Git USI 2010
Git USI 2010
 
Git Agile France 2010
Git Agile France 2010Git Agile France 2010
Git Agile France 2010
 
Mockito Chti JUG
Mockito Chti JUGMockito Chti JUG
Mockito Chti JUG
 
Git Chti JUG
Git Chti JUGGit Chti JUG
Git Chti JUG
 
Le Facilitateur, un role encore meconnu
Le Facilitateur, un role encore meconnuLe Facilitateur, un role encore meconnu
Le Facilitateur, un role encore meconnu
 

Dernier

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 

Dernier (20)

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
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...
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
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
 
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
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 

Let's make this test suite run faster