Automatiser les tests à
                         tous les niveaux
                                 Vincent Tencé
                                      @testinfected
                              http://noncomplexstuff.com
                             https://github.com/testinfected




Friday, 2 March, 12
D’abord le scénario
                                                                   Pa
                                                     m ent            ym
                                                ip                       e nt
                                             Sh


                           User Interface




                                                                                   Persistence
                                              Ma                           e
                                                il                   Tim




                        Test


                                            Vincent Tencé - Confoo - 2 mars 2012

Friday, 2 March, 12
Puis le domaine
                                                                Pa
                                                  m ent            ym
                                             ip                       e nt
                                          Sh


                        User Interface




                                                                                Persistence
                                           Ma                           e
                                             il                   Tim



                                          Test


                                         Vincent Tencé - Confoo - 2 mars 2012

Friday, 2 March, 12
Les tests nous guident
                                                                   Pa
                                                    m ent             ym
                                               ip                        e nt
                                            Sh


                           User Interface




                                                                                   Persistence
                                              Ma                           e
                                                il                   Tim




                                            Vincent Tencé - Confoo - 2 mars 2012

Friday, 2 March, 12
Ensuite les données
                                                                 Pa
                                                  m ent             ym
                                             ip                        e nt
                                          Sh


                         User Interface




                                                                                 Persistence
                                            Ma                           e
                                              il                   Tim
                                                                                               Test




                                          Vincent Tencé - Confoo - 2 mars 2012

Friday, 2 March, 12
Enfin la vue
                                                               Pa
                                                 m ent            ym
                                            ip                       e nt
                                         Sh


                      User Interface




                                                                               Persistence
                                          Ma                           e
                                            il                   Tim



                                       Test


                                        Vincent Tencé - Confoo - 2 mars 2012

Friday, 2 March, 12
Au final
                                                                 Pa
                                                   m ent            ym
                                              ip                       e nt
                                           Sh


                         User Interface




                                                                                 Persistence
                                            Ma                           e
                                              il                   Tim




                      Test


                                          Vincent Tencé - Confoo - 2 mars 2012

Friday, 2 March, 12
La stratégie




                        Vincent Tencé - Confoo - 2 mars 2012

Friday, 2 March, 12
La stratégie
                                   System




                        Vincent Tencé - Confoo - 2 mars 2012

Friday, 2 March, 12
La stratégie
                                   System

                               Acceptance




                        Vincent Tencé - Confoo - 2 mars 2012

Friday, 2 March, 12
La stratégie


                                 s
                                 st
                              Te
                                      System

                          mers
                       sto
                      Cu
                                  Acceptance




                           Vincent Tencé - Confoo - 2 mars 2012

Friday, 2 March, 12
La stratégie


                                 s
                                 st
                              Te
                                      System

                          mers
                       sto
                      Cu
                                  Acceptance


                                   Integration




                           Vincent Tencé - Confoo - 2 mars 2012

Friday, 2 March, 12
La stratégie


                                 s
                                 st
                              Te
                                      System

                          mers
                       sto
                      Cu
                                  Acceptance


                                   Integration

                                        Unit



                           Vincent Tencé - Confoo - 2 mars 2012

Friday, 2 March, 12
La stratégie


                                 s
                                 st
                              Te
                                      System

                          mers
                       sto
                      Cu
                                  Acceptance




                                                                  De
                                   Integration




                                                                    vel
                                                                        op
                                                                         rse
                                        Unit




                                                                          Te
                                                                             sts
                           Vincent Tencé - Confoo - 2 mars 2012

Friday, 2 March, 12
Friday, 2 March, 12
Écrire un test
                       qui échoue




Friday, 2 March, 12
Améliorer le
                                   message d’erreur




                      Écrire un test
                       qui échoue




Friday, 2 March, 12
Améliorer le
                                   message d’erreur




                      Écrire un test              Faire passer
                       qui échoue                    le test




Friday, 2 March, 12
Améliorer le
                                   message d’erreur




                      Écrire un test                  Faire passer
                       qui échoue                        le test




                                       Refactoriser


Friday, 2 March, 12
Améliorer le
                                   message d’erreur




                      Écrire un test                  Faire passer
                       qui échoue                        le test




                                       Refactoriser


Friday, 2 March, 12
Friday, 2 March, 12
Écrire un test
                      d’acceptance qui échoue




Friday, 2 March, 12
Améliorer le message
                                                                            d’erreur




                           Écrire un test          Écrire un test
                      d’acceptance qui échoue                                                Faire passer le test
                                                unitaire qui échoue




                                                                          Refactoriser




Friday, 2 March, 12
Améliorer le message
                                                                            d’erreur




                           Écrire un test          Écrire un test
                      d’acceptance qui échoue                                                Faire passer le test
                                                unitaire qui échoue




                                                                          Refactoriser




Friday, 2 March, 12
Un réseau d’objets




                           Vincent Tencé - Confoo - 2 mars 2012

Friday, 2 March, 12
Un réseau d’objets




                           Vincent Tencé - Confoo - 2 mars 2012

Friday, 2 March, 12
Un réseau d’objets




                           Vincent Tencé - Confoo - 2 mars 2012

Friday, 2 March, 12
Un réseau d’objets




                           Vincent Tencé - Confoo - 2 mars 2012

Friday, 2 March, 12
Un réseau d’objets




                           Vincent Tencé - Confoo - 2 mars 2012

Friday, 2 March, 12
Tester en isolation


                                         A




                           Vincent Tencé - Confoo - 2 mars 2012

Friday, 2 March, 12
Tester en isolation


                       Test                 A




                              Vincent Tencé - Confoo - 2 mars 2012

Friday, 2 March, 12
Tester en isolation


                       Test                 A                        S




                              Vincent Tencé - Confoo - 2 mars 2012

Friday, 2 March, 12
Tester en isolation


                       Test                 A                            mock S
                                                                     S




                              Vincent Tencé - Confoo - 2 mars 2012

Friday, 2 March, 12
Mock Objects

                      • Reproduisent le comportement
                        d’objets réels de manière
                        controllée
                      • L’accent est mis sur l’interaction
                        entre les objets



                                     Vincent Tencé - Confoo - 2 mars 2012

Friday, 2 March, 12
Ports and Adapters


                                       API




                           Vincent Tencé - Confoo - 2 mars 2012

Friday, 2 March, 12
Ports and Adapters


                                       API




                           Vincent Tencé - Confoo - 2 mars 2012

Friday, 2 March, 12
Ports and Adapters

                         User Interface




                                                                                 Persistence
                                                      API


                                                                         e
                                                                   Tim




                                          Vincent Tencé - Confoo - 2 mars 2012

Friday, 2 March, 12
Ports and Adapters

                         User Interface




                                                                         adapter

                                                                                   Persistence
                                                      API


                                                                         e
                                                                   Tim




                                          Vincent Tencé - Confoo - 2 mars 2012

Friday, 2 March, 12
En apprendre plus

                                                                       5 jours
                                                                    ou
                                                                       3 jours

                      http://pyxis-tech.com/fr/notre-offre/formation-
                      agile/professional-scrum-developer-java



                                    Vincent Tencé - Confoo - 2 mars 2012

Friday, 2 March, 12
TDD
                       All CODE IS GUILTY
                      UNTIL PROVEN INNOCENT




                                        Bons tests !

Friday, 2 March, 12

Confoo 2012 kata

  • 1.
    Automatiser les testsà tous les niveaux Vincent Tencé @testinfected http://noncomplexstuff.com https://github.com/testinfected Friday, 2 March, 12
  • 2.
    D’abord le scénario Pa m ent ym ip e nt Sh User Interface Persistence Ma e il Tim Test Vincent Tencé - Confoo - 2 mars 2012 Friday, 2 March, 12
  • 3.
    Puis le domaine Pa m ent ym ip e nt Sh User Interface Persistence Ma e il Tim Test Vincent Tencé - Confoo - 2 mars 2012 Friday, 2 March, 12
  • 4.
    Les tests nousguident Pa m ent ym ip e nt Sh User Interface Persistence Ma e il Tim Vincent Tencé - Confoo - 2 mars 2012 Friday, 2 March, 12
  • 5.
    Ensuite les données Pa m ent ym ip e nt Sh User Interface Persistence Ma e il Tim Test Vincent Tencé - Confoo - 2 mars 2012 Friday, 2 March, 12
  • 6.
    Enfin la vue Pa m ent ym ip e nt Sh User Interface Persistence Ma e il Tim Test Vincent Tencé - Confoo - 2 mars 2012 Friday, 2 March, 12
  • 7.
    Au final Pa m ent ym ip e nt Sh User Interface Persistence Ma e il Tim Test Vincent Tencé - Confoo - 2 mars 2012 Friday, 2 March, 12
  • 8.
    La stratégie Vincent Tencé - Confoo - 2 mars 2012 Friday, 2 March, 12
  • 9.
    La stratégie System Vincent Tencé - Confoo - 2 mars 2012 Friday, 2 March, 12
  • 10.
    La stratégie System Acceptance Vincent Tencé - Confoo - 2 mars 2012 Friday, 2 March, 12
  • 11.
    La stratégie s st Te System mers sto Cu Acceptance Vincent Tencé - Confoo - 2 mars 2012 Friday, 2 March, 12
  • 12.
    La stratégie s st Te System mers sto Cu Acceptance Integration Vincent Tencé - Confoo - 2 mars 2012 Friday, 2 March, 12
  • 13.
    La stratégie s st Te System mers sto Cu Acceptance Integration Unit Vincent Tencé - Confoo - 2 mars 2012 Friday, 2 March, 12
  • 14.
    La stratégie s st Te System mers sto Cu Acceptance De Integration vel op rse Unit Te sts Vincent Tencé - Confoo - 2 mars 2012 Friday, 2 March, 12
  • 15.
  • 16.
    Écrire un test qui échoue Friday, 2 March, 12
  • 17.
    Améliorer le message d’erreur Écrire un test qui échoue Friday, 2 March, 12
  • 18.
    Améliorer le message d’erreur Écrire un test Faire passer qui échoue le test Friday, 2 March, 12
  • 19.
    Améliorer le message d’erreur Écrire un test Faire passer qui échoue le test Refactoriser Friday, 2 March, 12
  • 20.
    Améliorer le message d’erreur Écrire un test Faire passer qui échoue le test Refactoriser Friday, 2 March, 12
  • 21.
  • 22.
    Écrire un test d’acceptance qui échoue Friday, 2 March, 12
  • 23.
    Améliorer le message d’erreur Écrire un test Écrire un test d’acceptance qui échoue Faire passer le test unitaire qui échoue Refactoriser Friday, 2 March, 12
  • 24.
    Améliorer le message d’erreur Écrire un test Écrire un test d’acceptance qui échoue Faire passer le test unitaire qui échoue Refactoriser Friday, 2 March, 12
  • 25.
    Un réseau d’objets Vincent Tencé - Confoo - 2 mars 2012 Friday, 2 March, 12
  • 26.
    Un réseau d’objets Vincent Tencé - Confoo - 2 mars 2012 Friday, 2 March, 12
  • 27.
    Un réseau d’objets Vincent Tencé - Confoo - 2 mars 2012 Friday, 2 March, 12
  • 28.
    Un réseau d’objets Vincent Tencé - Confoo - 2 mars 2012 Friday, 2 March, 12
  • 29.
    Un réseau d’objets Vincent Tencé - Confoo - 2 mars 2012 Friday, 2 March, 12
  • 30.
    Tester en isolation A Vincent Tencé - Confoo - 2 mars 2012 Friday, 2 March, 12
  • 31.
    Tester en isolation Test A Vincent Tencé - Confoo - 2 mars 2012 Friday, 2 March, 12
  • 32.
    Tester en isolation Test A S Vincent Tencé - Confoo - 2 mars 2012 Friday, 2 March, 12
  • 33.
    Tester en isolation Test A mock S S Vincent Tencé - Confoo - 2 mars 2012 Friday, 2 March, 12
  • 34.
    Mock Objects • Reproduisent le comportement d’objets réels de manière controllée • L’accent est mis sur l’interaction entre les objets Vincent Tencé - Confoo - 2 mars 2012 Friday, 2 March, 12
  • 35.
    Ports and Adapters API Vincent Tencé - Confoo - 2 mars 2012 Friday, 2 March, 12
  • 36.
    Ports and Adapters API Vincent Tencé - Confoo - 2 mars 2012 Friday, 2 March, 12
  • 37.
    Ports and Adapters User Interface Persistence API e Tim Vincent Tencé - Confoo - 2 mars 2012 Friday, 2 March, 12
  • 38.
    Ports and Adapters User Interface adapter Persistence API e Tim Vincent Tencé - Confoo - 2 mars 2012 Friday, 2 March, 12
  • 39.
    En apprendre plus 5 jours ou 3 jours http://pyxis-tech.com/fr/notre-offre/formation- agile/professional-scrum-developer-java Vincent Tencé - Confoo - 2 mars 2012 Friday, 2 March, 12
  • 40.
    TDD All CODE IS GUILTY UNTIL PROVEN INNOCENT Bons tests ! Friday, 2 March, 12