SlideShare a Scribd company logo
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’âme
Dany Maillard
 
Petite SoiréE Chez Max2
Petite SoiréE Chez Max2Petite SoiréE Chez Max2
Petite SoiréE Chez Max2
guest2ae29e
 
PréSentation2
PréSentation2PréSentation2
PréSentation2
guest2ae29e
 
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 08
guest03841f
 
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
NotiGen
 
Parfaits
ParfaitsParfaits
Parfaitscharbu2
 
Arxtech Mobilier Tactile Interactif
Arxtech Mobilier Tactile InteractifArxtech Mobilier Tactile Interactif
Arxtech Mobilier Tactile Interactif
Arxtech Canada
 
Clase 4 graficos
Clase 4 graficosClase 4 graficos
Clase 4 graficos
Univ Peruana Los Andes
 
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 1
charbu2
 
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
 
Tribus De L Omo
Tribus De L OmoTribus De L Omo
Tribus De L Omo
guest048cc5
 

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 Course
peter_marklund
 
Why Architecture in Web Development matters
Why Architecture in Web Development mattersWhy Architecture in Web Development matters
Why Architecture in Web Development matters
Lars 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 development
Nicolas 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 executables
Jeremy Hinegardner
 
Kamaelia - Networking Using Generators
Kamaelia - Networking Using GeneratorsKamaelia - Networking Using Generators
Kamaelia - Networking Using Generators
kamaelian
 
Ruby on Rails Presentation
Ruby on Rails PresentationRuby on Rails Presentation
Ruby on Rails Presentation
Michael MacDonald
 
Deploying And Monitoring Rails
Deploying And Monitoring RailsDeploying And Monitoring Rails
Deploying And Monitoring Rails
Jonathan 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 Education
Cybera Inc.
 
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
Vietnam Open Infrastructure User Group
 
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
 
Amoocon May 2009 Germany
Amoocon May 2009   GermanyAmoocon May 2009   Germany
Amoocon May 2009 Germany
Adhearsion Foundation
 
InterCon - Ruby e Rails
InterCon - Ruby e RailsInterCon - Ruby e Rails
InterCon - Ruby e Rails
Fabio Akita
 
Katello on TorqueBox
Katello on TorqueBoxKatello on TorqueBox
Katello on TorqueBox
lzap
 
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
Hiroshi 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_presentation
Jean-Michel Garnier
 
Tdd cara nov2010
Tdd cara nov2010Tdd cara nov2010
Tdd cara nov2010
Jean-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
 
Cucumber Ecosystem Presentation
Cucumber Ecosystem PresentationCucumber Ecosystem Presentation
Cucumber Ecosystem Presentation
Jean-Michel Garnier
 
Tests d'Acceptance utilisateur avec cucumber
Tests d'Acceptance utilisateur avec cucumberTests d'Acceptance utilisateur avec cucumber
Tests d'Acceptance utilisateur avec cucumber
Jean-Michel Garnier
 
Tests Interfaces Web avec Rails
Tests Interfaces Web avec RailsTests Interfaces Web avec Rails
Tests Interfaces Web avec Rails
Jean-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-grid
Jean-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
 
Testing Ruby on Rails (spanish)
Testing Ruby on Rails (spanish)Testing Ruby on Rails (spanish)
Testing Ruby on Rails (spanish)
Jean-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

State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.
ViralQR
 
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
UiPathCommunity
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
RinaMondal9
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 

Recently uploaded (20)

State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.
 
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 

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.