SlideShare a Scribd company logo
1 of 42
Download to read offline
Les Tests avec Ruby on Rails
Jean-Michel Garnier <jean-michel arobase 21croissants point com>
         Paris On Rails – 10 Décembre 2007
Plan de la présentation

    Background
●


        De 1975 ... à nos jours
    –

    Théorie
●


        RSpec par l'exemple
    –

        Design, Spécifications, Documentation
    –

    Pratique
●


        Outils: Autotest, rcov, CruiseControl.rb
    –

        RSpec on Rails, Selenium
    –


                                                                                              2
         Paris On Rail 2007 – Copyright (c) Garnier Jean-Michel. Licence: Creative Commons.
Background
Qui est-ce?
FRED BROOKS
                        1975:
      “The Mythical Man-Month”
          ¼    Spécificier
      ●



          1/6 Programmer
      ●



          ½    Tests
      ●



                         1986:
          “No Silver Bullet”
      Modèle en V =
      Vers le Modèle Itératif
      http://www.cs.unc.edu/~brooks/
Qui est-ce?
KENT BECK
                                      1994:
                            “Simple Smalltalk Testing”
                        ●



                        Framework pour automatiser
                          les tests unitaires


                                      2002:
                        “Test Driven Development”
                        Ecrire les tests avant le code


http://www.threeriversinstitute.org/Kent%20Beck.htm
Qui est-ce?
MARTIN FOWLER

                  2000:
          “Refactoring”
      ●


          article sur l'Intégration
      ●

          Continue
      http://www.martinfowler.com
L'équipe de RSpec

                                          Début 2004 : BDD
                                      ●


                                          Août 2005: RSpec 0.1
                                      ●


                                          Mai 2007: RSpec 1.0
                                      ●


                                          30 250 downloads
                                      ●
Aslak Hellesøy (NO) David Chelimsky
                                          (nº27) RubyForge
                    (US)

                                          40 contributeurs
                                      ●




                      + Brian Takita Dave Astels
                        Steve Baker Luke Redpath
Dan North (UK)
Livres pour 2008
Théorie
Anatomie d'une spécification
Comportement (contexte)




                                                 Exemple


                                             Exemple
should I stay or should I go?

RSpec ajoute 2 méthodes à la class 'Object': should et
 should_not




Avec Test::Unit :




             Paris On Rail 2007 – Copyright (c) Garnier Jean-Michel. Licence: Creative Commons.
Langage naturel (en VO)
ruby spec/project_spec.rb
Résultat




Paris On Rail 2007 – Copyright (c) Garnier Jean-Michel. Licence: Creative Commons.
Customizer Rspec



          Pas très lisible!
Solution: écrire son propre “Matcher”
http://martinfowler.com/articles/mocksArentStubs.html




       Paris On Rail 2007 – Copyright (c) Garnier Jean-Michel. Licence: Creative Commons.
Tests = Design

    TDD = On ne code que l'indispensable!
●



    Le Refactoring (Améliorer le code) ne provoque pas de
●

    regressions
    Utilisation de “mocks objects” pour définir l'API
●



    Le code de qualité est facile à tester
●




               Paris On Rail 2007 – Copyright (c) Garnier Jean-Michel. Licence: Creative Commons.
Tests = Spécifications
Tests = Documentation


                                                 Exemples exécutable =
                                            ●

                                                 Documentation toujours á
                                                 jour
                                                 Plus besoin de rdoc ;-)
                                            ●




 Paris On Rail 2007 – Copyright (c) Garnier Jean-Michel. Licence: Creative Commons.
Pratique
Démarrage

    Peep Code: RSpec (in english)
●



    IDE: RSpec intégré avec:
●




    Installer les plugins rspec et rspec_on_rails
●



    rake spec:generate
●




               Paris On Rail 2007 – Copyright (c) Garnier Jean-Michel. Licence: Creative Commons.
Autotest

    Problème: les specs s'executent pendant 10 min...
●



    Solution: Autotest n'execute que les specs nécessaires
●



Notifications visuelles (plugins Growl, Notify,...) et sonores



    Intégré avec
●




    http://ph7spot.com/articles/getting_started_with_autotest
                Paris On Rail 2007 – Copyright (c) Garnier Jean-Michel. Licence: Creative Commons.
Garantir la couverture avec
                     rcov
    sudo gem install rcov
●



    rake spec:rcov
●




                          http://eigenclass.org/hiki.rb?rcov
                Paris On Rail 2007 – Copyright (c) Garnier Jean-Michel. Licence: Creative Commons.
Couverture détaillée
Intégration Continue


                                            http://cruisecontrolrb.thoughtworks.com




                                          cruise add <name> -u <url>
                                          cruise start
                                         Le lapin il est ROUGE?
                                         Le Build il est cassé!
                                            http://nabaztag.rubyforge.org/


Paris On Rail 2007 – Copyright (c) Garnier Jean-Michel. Licence: Creative Commons.
CruiseControl.rb
Exemple de spec/models




http://edgerepo.com/svn/opensource/ruby/plugins/rspec_expectation_matchers/
spec/models (méthodes Métier)




    Paris On Rail 2007 – Copyright (c) Garnier Jean-Michel. Licence: Creative Commons.
spec/models (Finders)




Paris On Rail 2007 – Copyright (c) Garnier Jean-Michel. Licence: Creative Commons.
specs/fixtures

    Quelque problèmes: associations, lisibilité
●



    Mais ça s'améliore dans Rails 2.0 (un peu)
●



    Alternatives:
●


        Fixture scenarios: http://errtheblog.com/post/7708
    –

        Tests exemplars:
    –

         http://evang.eli.st/blog/2007/8/8/doin-the-fixtures-plugin-thing




                  Paris On Rail 2007 – Copyright (c) Garnier Jean-Michel. Licence: Creative Commons.
Exemple de spec/controllers
Autres “matchers“




Paris On Rail 2007 – Copyright (c) Garnier Jean-Michel. Licence: Creative Commons.
Spécifier les Vues?

                                         Problème:
                                         Les vues changent
                                         tout le temps !




Paris On Rail 2007 – Copyright (c) Garnier Jean-Michel. Licence: Creative Commons.
Exemple de spec/views




 Paris On Rail 2007 – Copyright (c) Garnier Jean-Michel. Licence: Creative Commons.
Selenium

    Tests d'intégration + automatiser les tests d'acceptation
●

    des utilisateurs
     Vérifier si l'application fonctionne avec tous les
●

    butineurs du marché
    Compatible avec:
●




               Paris On Rail 2007 – Copyright (c) Garnier Jean-Michel. Licence: Creative Commons.
Selenium – le film




Paris On Rail 2007 – Copyright (c) Garnier Jean-Michel. Licence: Creative Commons.
Selenium specs




90% de la spec GENERE AVEC SELENIUM-IDE !!!
Merci de votre attention!

       Questions - Réponses




                                                                                     42
Paris On Rail 2007 – Copyright (c) Garnier Jean-Michel. Licence: Creative Commons.

More Related Content

Viewers also liked

Tarea 8 uso video_carmen indira velez
Tarea 8 uso video_carmen indira velezTarea 8 uso video_carmen indira velez
Tarea 8 uso video_carmen indira velezcarivfi
 
French Trip
French TripFrench Trip
French Tripmrverney
 
Le visage est l’image de l’âme
Le visage est l’image de l’âmeLe visage est l’image de l’âme
Le visage est l’image de l’âmeDany Maillard
 
Petite SoiréE Chez Max2
Petite SoiréE Chez Max2Petite SoiréE Chez Max2
Petite SoiréE Chez Max2guest2ae29e
 
Le Petit Chaperon Rouge
Le Petit Chaperon RougeLe Petit Chaperon Rouge
Le Petit Chaperon Rougeguest5c0510
 
Pda Inoxia Janvier 08
Pda Inoxia Janvier 08Pda Inoxia Janvier 08
Pda Inoxia Janvier 08guest03841f
 
Jewishgen, El Hogar de la Genealogía Judía
Jewishgen, El Hogar de la Genealogía JudíaJewishgen, El Hogar de la Genealogía Judía
Jewishgen, El Hogar de la Genealogía JudíaNotiGen
 
Parfaits
ParfaitsParfaits
Parfaitscharbu2
 
Arxtech Mobilier Tactile Interactif
Arxtech Mobilier Tactile InteractifArxtech Mobilier Tactile Interactif
Arxtech Mobilier Tactile InteractifArxtech Canada
 
Citations de spiritualite (6)
Citations de spiritualite (6)Citations de spiritualite (6)
Citations de spiritualite (6)alboflede
 
Leparachute Tr Sbeautexte 1
Leparachute Tr Sbeautexte 1Leparachute Tr Sbeautexte 1
Leparachute Tr Sbeautexte 1charbu2
 
Village Eco Prg Du 17 DéC08 Vs Finale
Village Eco Prg Du 17 DéC08 Vs FinaleVillage Eco Prg Du 17 DéC08 Vs Finale
Village Eco Prg Du 17 DéC08 Vs FinaleAfet
 
S Curit Routi Re
S Curit Routi ReS Curit Routi Re
S Curit Routi Reguestf344b8
 

Viewers also liked (20)

Bejal
BejalBejal
Bejal
 
Tarea 8 uso video_carmen indira velez
Tarea 8 uso video_carmen indira velezTarea 8 uso video_carmen indira velez
Tarea 8 uso video_carmen indira velez
 
French Trip
French TripFrench Trip
French Trip
 
Le visage est l’image de l’âme
Le visage est l’image de l’âmeLe visage est l’image de l’âme
Le visage est l’image de l’âme
 
Petite SoiréE Chez Max2
Petite SoiréE Chez Max2Petite SoiréE Chez Max2
Petite SoiréE Chez Max2
 
Nettoyeur
NettoyeurNettoyeur
Nettoyeur
 
PréSentation2
PréSentation2PréSentation2
PréSentation2
 
Le Petit Chaperon Rouge
Le Petit Chaperon RougeLe Petit Chaperon Rouge
Le Petit Chaperon Rouge
 
Pda Inoxia Janvier 08
Pda Inoxia Janvier 08Pda Inoxia Janvier 08
Pda Inoxia Janvier 08
 
Couleursdumonde
CouleursdumondeCouleursdumonde
Couleursdumonde
 
Jewishgen, El Hogar de la Genealogía Judía
Jewishgen, El Hogar de la Genealogía JudíaJewishgen, El Hogar de la Genealogía Judía
Jewishgen, El Hogar de la Genealogía Judía
 
Alex C Publicite
Alex C PubliciteAlex C Publicite
Alex C Publicite
 
Parfaits
ParfaitsParfaits
Parfaits
 
Arxtech Mobilier Tactile Interactif
Arxtech Mobilier Tactile InteractifArxtech Mobilier Tactile Interactif
Arxtech Mobilier Tactile Interactif
 
Clase 4 graficos
Clase 4 graficosClase 4 graficos
Clase 4 graficos
 
Citations de spiritualite (6)
Citations de spiritualite (6)Citations de spiritualite (6)
Citations de spiritualite (6)
 
Leparachute Tr Sbeautexte 1
Leparachute Tr Sbeautexte 1Leparachute Tr Sbeautexte 1
Leparachute Tr Sbeautexte 1
 
Village Eco Prg Du 17 DéC08 Vs Finale
Village Eco Prg Du 17 DéC08 Vs FinaleVillage Eco Prg Du 17 DéC08 Vs Finale
Village Eco Prg Du 17 DéC08 Vs Finale
 
S Curit Routi Re
S Curit Routi ReS Curit Routi Re
S Curit Routi Re
 
Tribus De L Omo
Tribus De L OmoTribus De L Omo
Tribus De L Omo
 

Similar to Les Tests avec Ruby on Rails et RSpec (in French)

Ruby on Rails 101 - Presentation Slides for a Five Day Introductory Course
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory CourseRuby on Rails 101 - Presentation Slides for a Five Day Introductory Course
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory Coursepeter_marklund
 
Why Architecture in Web Development matters
Why Architecture in Web Development mattersWhy Architecture in Web Development matters
Why Architecture in Web Development mattersLars Jankowfsky
 
Starting a new ruby on rails development
Starting a new ruby on rails developmentStarting a new ruby on rails development
Starting a new ruby on rails developmentNicolas Alpi
 
Kamaelia-ACCU-20050422
Kamaelia-ACCU-20050422Kamaelia-ACCU-20050422
Kamaelia-ACCU-20050422journeyer
 
Peer Code Review: In a Nutshell and The Tantric Team: Getting Your Automated ...
Peer Code Review: In a Nutshell and The Tantric Team: Getting Your Automated ...Peer Code Review: In a Nutshell and The Tantric Team: Getting Your Automated ...
Peer Code Review: In a Nutshell and The Tantric Team: Getting Your Automated ...Atlassian
 
Scaling a Rails Application from the Bottom Up
Scaling a Rails Application from the Bottom Up Scaling a Rails Application from the Bottom Up
Scaling a Rails Application from the Bottom Up Abhishek Singh
 
Crate - ruby based standalone executables
Crate - ruby based standalone executablesCrate - ruby based standalone executables
Crate - ruby based standalone executablesJeremy Hinegardner
 
Kamaelia - Networking Using Generators
Kamaelia - Networking Using GeneratorsKamaelia - Networking Using Generators
Kamaelia - Networking Using Generatorskamaelian
 
Deploying And Monitoring Rails
Deploying And Monitoring RailsDeploying And Monitoring Rails
Deploying And Monitoring RailsJonathan Weiss
 
nanoHUB.org: Cyberinfrastructure for Research and Education
nanoHUB.org: Cyberinfrastructure for Research and EducationnanoHUB.org: Cyberinfrastructure for Research and Education
nanoHUB.org: Cyberinfrastructure for Research and EducationCybera Inc.
 
Web development with Lua: Introducing Sailor an MVC web framework @ CodingSer...
Web development with Lua: Introducing Sailor an MVC web framework @ CodingSer...Web development with Lua: Introducing Sailor an MVC web framework @ CodingSer...
Web development with Lua: Introducing Sailor an MVC web framework @ CodingSer...Etiene Dalcol
 
Rails Conf Europe 2007 Notes
Rails Conf  Europe 2007  NotesRails Conf  Europe 2007  Notes
Rails Conf Europe 2007 NotesRoss Lawley
 
InterCon - Ruby e Rails
InterCon - Ruby e RailsInterCon - Ruby e Rails
InterCon - Ruby e RailsFabio Akita
 
Katello on TorqueBox
Katello on TorqueBoxKatello on TorqueBox
Katello on TorqueBoxlzap
 
The details of CI/CD environment for Ruby
The details of CI/CD environment for RubyThe details of CI/CD environment for Ruby
The details of CI/CD environment for RubyHiroshi SHIBATA
 
So gelingt der Umstieg von PHP4 auf PHP5: Erneuerung von Geschäftsanwendung...
So gelingt der Umstieg von PHP4 auf  PHP5: Erneuerung von  Geschäftsanwendung...So gelingt der Umstieg von PHP4 auf  PHP5: Erneuerung von  Geschäftsanwendung...
So gelingt der Umstieg von PHP4 auf PHP5: Erneuerung von Geschäftsanwendung...Lars Jankowfsky
 

Similar to Les Tests avec Ruby on Rails et RSpec (in French) (20)

Ruby on Rails 101 - Presentation Slides for a Five Day Introductory Course
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory CourseRuby on Rails 101 - Presentation Slides for a Five Day Introductory Course
Ruby on Rails 101 - Presentation Slides for a Five Day Introductory Course
 
Why Architecture in Web Development matters
Why Architecture in Web Development mattersWhy Architecture in Web Development matters
Why Architecture in Web Development matters
 
Starting a new ruby on rails development
Starting a new ruby on rails developmentStarting a new ruby on rails development
Starting a new ruby on rails development
 
Kamaelia-ACCU-20050422
Kamaelia-ACCU-20050422Kamaelia-ACCU-20050422
Kamaelia-ACCU-20050422
 
Peer Code Review: In a Nutshell and The Tantric Team: Getting Your Automated ...
Peer Code Review: In a Nutshell and The Tantric Team: Getting Your Automated ...Peer Code Review: In a Nutshell and The Tantric Team: Getting Your Automated ...
Peer Code Review: In a Nutshell and The Tantric Team: Getting Your Automated ...
 
Scaling a Rails Application from the Bottom Up
Scaling a Rails Application from the Bottom Up Scaling a Rails Application from the Bottom Up
Scaling a Rails Application from the Bottom Up
 
Crate - ruby based standalone executables
Crate - ruby based standalone executablesCrate - ruby based standalone executables
Crate - ruby based standalone executables
 
Kamaelia - Networking Using Generators
Kamaelia - Networking Using GeneratorsKamaelia - Networking Using Generators
Kamaelia - Networking Using Generators
 
Ruby on Rails Presentation
Ruby on Rails PresentationRuby on Rails Presentation
Ruby on Rails Presentation
 
Deploying And Monitoring Rails
Deploying And Monitoring RailsDeploying And Monitoring Rails
Deploying And Monitoring Rails
 
nanoHUB.org: Cyberinfrastructure for Research and Education
nanoHUB.org: Cyberinfrastructure for Research and EducationnanoHUB.org: Cyberinfrastructure for Research and Education
nanoHUB.org: Cyberinfrastructure for Research and Education
 
Quick and Solid - Baremetal on OpenStack | Rico Lin
Quick and Solid - Baremetal on OpenStack | Rico LinQuick and Solid - Baremetal on OpenStack | Rico Lin
Quick and Solid - Baremetal on OpenStack | Rico Lin
 
Web development with Lua: Introducing Sailor an MVC web framework @ CodingSer...
Web development with Lua: Introducing Sailor an MVC web framework @ CodingSer...Web development with Lua: Introducing Sailor an MVC web framework @ CodingSer...
Web development with Lua: Introducing Sailor an MVC web framework @ CodingSer...
 
Rails Conf Europe 2007 Notes
Rails Conf  Europe 2007  NotesRails Conf  Europe 2007  Notes
Rails Conf Europe 2007 Notes
 
Amoocon May 2009 Germany
Amoocon May 2009   GermanyAmoocon May 2009   Germany
Amoocon May 2009 Germany
 
InterCon - Ruby e Rails
InterCon - Ruby e RailsInterCon - Ruby e Rails
InterCon - Ruby e Rails
 
Till Vollmer Presentation
Till Vollmer PresentationTill Vollmer Presentation
Till Vollmer Presentation
 
Katello on TorqueBox
Katello on TorqueBoxKatello on TorqueBox
Katello on TorqueBox
 
The details of CI/CD environment for Ruby
The details of CI/CD environment for RubyThe details of CI/CD environment for Ruby
The details of CI/CD environment for Ruby
 
So gelingt der Umstieg von PHP4 auf PHP5: Erneuerung von Geschäftsanwendung...
So gelingt der Umstieg von PHP4 auf  PHP5: Erneuerung von  Geschäftsanwendung...So gelingt der Umstieg von PHP4 auf  PHP5: Erneuerung von  Geschäftsanwendung...
So gelingt der Umstieg von PHP4 auf PHP5: Erneuerung von Geschäftsanwendung...
 

More from Jean-Michel Garnier

2015 07 08_genevarb_maniok_presentation
2015 07 08_genevarb_maniok_presentation2015 07 08_genevarb_maniok_presentation
2015 07 08_genevarb_maniok_presentationJean-Michel Garnier
 
Spécification par l'exemple & Tests d'Acceptance Agile avec cucumber
Spécification par l'exemple & Tests d'Acceptance Agile  avec cucumberSpécification par l'exemple & Tests d'Acceptance Agile  avec cucumber
Spécification par l'exemple & Tests d'Acceptance Agile avec cucumberJean-Michel Garnier
 
Tests d'Acceptance utilisateur avec cucumber
Tests d'Acceptance utilisateur avec cucumberTests d'Acceptance utilisateur avec cucumber
Tests d'Acceptance utilisateur avec cucumberJean-Michel Garnier
 
Fast web acceptance testing with selenium-grid
Fast web acceptance testing with selenium-gridFast web acceptance testing with selenium-grid
Fast web acceptance testing with selenium-gridJean-Michel Garnier
 
User Acceptance Testing Driven by Humans telling Stories (with RSpec)
User Acceptance Testing Driven by Humans telling Stories (with RSpec)User Acceptance Testing Driven by Humans telling Stories (with RSpec)
User Acceptance Testing Driven by Humans telling Stories (with RSpec)Jean-Michel Garnier
 
Intro a RSpec, BDD, webapps User Acceptance Testing
Intro a RSpec, BDD, webapps User Acceptance TestingIntro a RSpec, BDD, webapps User Acceptance Testing
Intro a RSpec, BDD, webapps User Acceptance TestingJean-Michel Garnier
 

More from Jean-Michel Garnier (11)

2015 07 08_genevarb_maniok_presentation
2015 07 08_genevarb_maniok_presentation2015 07 08_genevarb_maniok_presentation
2015 07 08_genevarb_maniok_presentation
 
Tdd cara nov2010
Tdd cara nov2010Tdd cara nov2010
Tdd cara nov2010
 
Spécification par l'exemple & Tests d'Acceptance Agile avec cucumber
Spécification par l'exemple & Tests d'Acceptance Agile  avec cucumberSpécification par l'exemple & Tests d'Acceptance Agile  avec cucumber
Spécification par l'exemple & Tests d'Acceptance Agile avec cucumber
 
Cucumber Ecosystem Presentation
Cucumber Ecosystem PresentationCucumber Ecosystem Presentation
Cucumber Ecosystem Presentation
 
Tests d'Acceptance utilisateur avec cucumber
Tests d'Acceptance utilisateur avec cucumberTests d'Acceptance utilisateur avec cucumber
Tests d'Acceptance utilisateur avec cucumber
 
Tests Interfaces Web avec Rails
Tests Interfaces Web avec RailsTests Interfaces Web avec Rails
Tests Interfaces Web avec Rails
 
Fast web acceptance testing with selenium-grid
Fast web acceptance testing with selenium-gridFast web acceptance testing with selenium-grid
Fast web acceptance testing with selenium-grid
 
User Acceptance Testing Driven by Humans telling Stories (with RSpec)
User Acceptance Testing Driven by Humans telling Stories (with RSpec)User Acceptance Testing Driven by Humans telling Stories (with RSpec)
User Acceptance Testing Driven by Humans telling Stories (with RSpec)
 
Intro a RSpec, BDD, webapps User Acceptance Testing
Intro a RSpec, BDD, webapps User Acceptance TestingIntro a RSpec, BDD, webapps User Acceptance Testing
Intro a RSpec, BDD, webapps User Acceptance Testing
 
Global Warming Lifestyle Change
Global Warming Lifestyle ChangeGlobal Warming Lifestyle Change
Global Warming Lifestyle Change
 
Testing Ruby on Rails (spanish)
Testing Ruby on Rails (spanish)Testing Ruby on Rails (spanish)
Testing Ruby on Rails (spanish)
 

Recently uploaded

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
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 2024The Digital Insurer
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
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...Drew Madelung
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
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, ...apidays
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
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...Miguel Araújo
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
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 DevelopmentsTrustArc
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 

Recently uploaded (20)

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
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
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
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...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
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, ...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
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...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
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
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 

Les Tests avec Ruby on Rails et RSpec (in French)

  • 1. Les Tests avec Ruby on Rails Jean-Michel Garnier <jean-michel arobase 21croissants point com> Paris On Rails – 10 Décembre 2007
  • 2. Plan de la présentation Background ● De 1975 ... à nos jours – Théorie ● RSpec par l'exemple – Design, Spécifications, Documentation – Pratique ● Outils: Autotest, rcov, CruiseControl.rb – RSpec on Rails, Selenium – 2 Paris On Rail 2007 – Copyright (c) Garnier Jean-Michel. Licence: Creative Commons.
  • 4.
  • 6. FRED BROOKS 1975: “The Mythical Man-Month” ¼ Spécificier ● 1/6 Programmer ● ½ Tests ● 1986: “No Silver Bullet” Modèle en V = Vers le Modèle Itératif http://www.cs.unc.edu/~brooks/
  • 8. KENT BECK 1994: “Simple Smalltalk Testing” ● Framework pour automatiser les tests unitaires 2002: “Test Driven Development” Ecrire les tests avant le code http://www.threeriversinstitute.org/Kent%20Beck.htm
  • 10. MARTIN FOWLER 2000: “Refactoring” ● article sur l'Intégration ● Continue http://www.martinfowler.com
  • 11. L'équipe de RSpec Début 2004 : BDD ● Août 2005: RSpec 0.1 ● Mai 2007: RSpec 1.0 ● 30 250 downloads ● Aslak Hellesøy (NO) David Chelimsky (nº27) RubyForge (US) 40 contributeurs ● + Brian Takita Dave Astels Steve Baker Luke Redpath Dan North (UK)
  • 14. Anatomie d'une spécification Comportement (contexte) Exemple Exemple
  • 15. should I stay or should I go? RSpec ajoute 2 méthodes à la class 'Object': should et should_not Avec Test::Unit : Paris On Rail 2007 – Copyright (c) Garnier Jean-Michel. Licence: Creative Commons.
  • 18. Résultat Paris On Rail 2007 – Copyright (c) Garnier Jean-Michel. Licence: Creative Commons.
  • 19. Customizer Rspec Pas très lisible! Solution: écrire son propre “Matcher”
  • 20. http://martinfowler.com/articles/mocksArentStubs.html Paris On Rail 2007 – Copyright (c) Garnier Jean-Michel. Licence: Creative Commons.
  • 21. Tests = Design TDD = On ne code que l'indispensable! ● Le Refactoring (Améliorer le code) ne provoque pas de ● regressions Utilisation de “mocks objects” pour définir l'API ● Le code de qualité est facile à tester ● Paris On Rail 2007 – Copyright (c) Garnier Jean-Michel. Licence: Creative Commons.
  • 23. Tests = Documentation Exemples exécutable = ● Documentation toujours á jour Plus besoin de rdoc ;-) ● Paris On Rail 2007 – Copyright (c) Garnier Jean-Michel. Licence: Creative Commons.
  • 25. Démarrage Peep Code: RSpec (in english) ● IDE: RSpec intégré avec: ● Installer les plugins rspec et rspec_on_rails ● rake spec:generate ● Paris On Rail 2007 – Copyright (c) Garnier Jean-Michel. Licence: Creative Commons.
  • 26. Autotest Problème: les specs s'executent pendant 10 min... ● Solution: Autotest n'execute que les specs nécessaires ● Notifications visuelles (plugins Growl, Notify,...) et sonores Intégré avec ● http://ph7spot.com/articles/getting_started_with_autotest Paris On Rail 2007 – Copyright (c) Garnier Jean-Michel. Licence: Creative Commons.
  • 27. Garantir la couverture avec rcov sudo gem install rcov ● rake spec:rcov ● http://eigenclass.org/hiki.rb?rcov Paris On Rail 2007 – Copyright (c) Garnier Jean-Michel. Licence: Creative Commons.
  • 29. Intégration Continue http://cruisecontrolrb.thoughtworks.com cruise add <name> -u <url> cruise start Le lapin il est ROUGE? Le Build il est cassé! http://nabaztag.rubyforge.org/ Paris On Rail 2007 – Copyright (c) Garnier Jean-Michel. Licence: Creative Commons.
  • 32. spec/models (méthodes Métier) Paris On Rail 2007 – Copyright (c) Garnier Jean-Michel. Licence: Creative Commons.
  • 33. spec/models (Finders) Paris On Rail 2007 – Copyright (c) Garnier Jean-Michel. Licence: Creative Commons.
  • 34. specs/fixtures Quelque problèmes: associations, lisibilité ● Mais ça s'améliore dans Rails 2.0 (un peu) ● Alternatives: ● Fixture scenarios: http://errtheblog.com/post/7708 – Tests exemplars: – http://evang.eli.st/blog/2007/8/8/doin-the-fixtures-plugin-thing Paris On Rail 2007 – Copyright (c) Garnier Jean-Michel. Licence: Creative Commons.
  • 36. Autres “matchers“ Paris On Rail 2007 – Copyright (c) Garnier Jean-Michel. Licence: Creative Commons.
  • 37. Spécifier les Vues? Problème: Les vues changent tout le temps ! Paris On Rail 2007 – Copyright (c) Garnier Jean-Michel. Licence: Creative Commons.
  • 38. Exemple de spec/views Paris On Rail 2007 – Copyright (c) Garnier Jean-Michel. Licence: Creative Commons.
  • 39. Selenium Tests d'intégration + automatiser les tests d'acceptation ● des utilisateurs Vérifier si l'application fonctionne avec tous les ● butineurs du marché Compatible avec: ● Paris On Rail 2007 – Copyright (c) Garnier Jean-Michel. Licence: Creative Commons.
  • 40. Selenium – le film Paris On Rail 2007 – Copyright (c) Garnier Jean-Michel. Licence: Creative Commons.
  • 41. Selenium specs 90% de la spec GENERE AVEC SELENIUM-IDE !!!
  • 42. Merci de votre attention! Questions - Réponses 42 Paris On Rail 2007 – Copyright (c) Garnier Jean-Michel. Licence: Creative Commons.