introduction aux tests automatisés et au tdd · « practices like tdd and bdd are widespread and...
TRANSCRIPT
![Page 1: Introduction aux tests automatisés et au TDD · « Practices like TDD and BDD are widespread and applied almost unquestionably.It has been a while since I’veseen teams that do](https://reader034.vdocuments.us/reader034/viewer/2022042913/5f4c18b436f5b16eea00f592/html5/thumbnails/1.jpg)
FÉLIX-ANTOINE BOURBONNAISB.ING., M.SC., PSM
Version 2016-08
Introduction aux tests automatisés et au TDD
![Page 2: Introduction aux tests automatisés et au TDD · « Practices like TDD and BDD are widespread and applied almost unquestionably.It has been a while since I’veseen teams that do](https://reader034.vdocuments.us/reader034/viewer/2022042913/5f4c18b436f5b16eea00f592/html5/thumbnails/2.jpg)
Source: Robert C. Martin
Selon vous, c’est quoi ?
![Page 3: Introduction aux tests automatisés et au TDD · « Practices like TDD and BDD are widespread and applied almost unquestionably.It has been a while since I’veseen teams that do](https://reader034.vdocuments.us/reader034/viewer/2022042913/5f4c18b436f5b16eea00f592/html5/thumbnails/3.jpg)
4
Félix-Antoine BourbonnaisB.ing., PSM, M.Sc.
![Page 4: Introduction aux tests automatisés et au TDD · « Practices like TDD and BDD are widespread and applied almost unquestionably.It has been a while since I’veseen teams that do](https://reader034.vdocuments.us/reader034/viewer/2022042913/5f4c18b436f5b16eea00f592/html5/thumbnails/4.jpg)
5 5
Je suis…
/ Formateur/ Conférencier/ Coach technique/ Coach Agile
Expert en…
/ Tests automatisés/ Pratiques de développement/ Architecture évolutive/ Spécification par l’exemple et BDD/ Agilité et Scrum
Félix-Antoine Bourbonnais
![Page 6: Introduction aux tests automatisés et au TDD · « Practices like TDD and BDD are widespread and applied almost unquestionably.It has been a while since I’veseen teams that do](https://reader034.vdocuments.us/reader034/viewer/2022042913/5f4c18b436f5b16eea00f592/html5/thumbnails/6.jpg)
Bienvenue!
Image de Eyesplashhttp://commons.wikimedia.org/wiki/File:Welkom_willkommen_Welcome_Bienvenue_Benvenuto.jpg
![Page 7: Introduction aux tests automatisés et au TDD · « Practices like TDD and BDD are widespread and applied almost unquestionably.It has been a while since I’veseen teams that do](https://reader034.vdocuments.us/reader034/viewer/2022042913/5f4c18b436f5b16eea00f592/html5/thumbnails/7.jpg)
Pourquoi êtes-vous ici ?
8
![Page 8: Introduction aux tests automatisés et au TDD · « Practices like TDD and BDD are widespread and applied almost unquestionably.It has been a while since I’veseen teams that do](https://reader034.vdocuments.us/reader034/viewer/2022042913/5f4c18b436f5b16eea00f592/html5/thumbnails/8.jpg)
Stimuler la discussion et comprendre l’impact de
l’automatisation de tests.
Profitez-en et posez des questions !
Objectif
9
![Page 9: Introduction aux tests automatisés et au TDD · « Practices like TDD and BDD are widespread and applied almost unquestionably.It has been a while since I’veseen teams that do](https://reader034.vdocuments.us/reader034/viewer/2022042913/5f4c18b436f5b16eea00f592/html5/thumbnails/9.jpg)
Qui aime ça faire des tests manuels?
10
![Page 10: Introduction aux tests automatisés et au TDD · « Practices like TDD and BDD are widespread and applied almost unquestionably.It has been a while since I’veseen teams that do](https://reader034.vdocuments.us/reader034/viewer/2022042913/5f4c18b436f5b16eea00f592/html5/thumbnails/10.jpg)
11
![Page 11: Introduction aux tests automatisés et au TDD · « Practices like TDD and BDD are widespread and applied almost unquestionably.It has been a while since I’veseen teams that do](https://reader034.vdocuments.us/reader034/viewer/2022042913/5f4c18b436f5b16eea00f592/html5/thumbnails/11.jpg)
Image de Robert. C. Martin Utilisée avec permission de l’auteur / Use with the permission of the author.
Quel est le problème?
![Page 12: Introduction aux tests automatisés et au TDD · « Practices like TDD and BDD are widespread and applied almost unquestionably.It has been a while since I’veseen teams that do](https://reader034.vdocuments.us/reader034/viewer/2022042913/5f4c18b436f5b16eea00f592/html5/thumbnails/12.jpg)
La réalité…
![Page 13: Introduction aux tests automatisés et au TDD · « Practices like TDD and BDD are widespread and applied almost unquestionably.It has been a while since I’veseen teams that do](https://reader034.vdocuments.us/reader034/viewer/2022042913/5f4c18b436f5b16eea00f592/html5/thumbnails/13.jpg)
Plus un problème est
découvert tard,
plus il coûte cher…
La boucle de rétroaction…
14
![Page 14: Introduction aux tests automatisés et au TDD · « Practices like TDD and BDD are widespread and applied almost unquestionably.It has been a while since I’veseen teams that do](https://reader034.vdocuments.us/reader034/viewer/2022042913/5f4c18b436f5b16eea00f592/html5/thumbnails/14.jpg)
Quelques statistiques
15
![Page 16: Introduction aux tests automatisés et au TDD · « Practices like TDD and BDD are widespread and applied almost unquestionably.It has been a while since I’veseen teams that do](https://reader034.vdocuments.us/reader034/viewer/2022042913/5f4c18b436f5b16eea00f592/html5/thumbnails/16.jpg)
Faire des tests
le plus tôt possible
Moralité…
17
![Page 17: Introduction aux tests automatisés et au TDD · « Practices like TDD and BDD are widespread and applied almost unquestionably.It has been a while since I’veseen teams that do](https://reader034.vdocuments.us/reader034/viewer/2022042913/5f4c18b436f5b16eea00f592/html5/thumbnails/17.jpg)
18
![Page 18: Introduction aux tests automatisés et au TDD · « Practices like TDD and BDD are widespread and applied almost unquestionably.It has been a while since I’veseen teams that do](https://reader034.vdocuments.us/reader034/viewer/2022042913/5f4c18b436f5b16eea00f592/html5/thumbnails/18.jpg)
Mission: Innover
6 000 développeurs
>1 500 projets
>20 changements/minute
50% du code change tous les mois
Chiffres de 2010
Dans l’industrie: Google
19
![Page 19: Introduction aux tests automatisés et au TDD · « Practices like TDD and BDD are widespread and applied almost unquestionably.It has been a while since I’veseen teams that do](https://reader034.vdocuments.us/reader034/viewer/2022042913/5f4c18b436f5b16eea00f592/html5/thumbnails/19.jpg)
« If it can be automated and the problem doesn’t require human
cleverness and intuition, then it shouldbe automated »
-- How Google Tests Software, James A. Whittaker
Automatisé ?
20
![Page 20: Introduction aux tests automatisés et au TDD · « Practices like TDD and BDD are widespread and applied almost unquestionably.It has been a while since I’veseen teams that do](https://reader034.vdocuments.us/reader034/viewer/2022042913/5f4c18b436f5b16eea00f592/html5/thumbnails/20.jpg)
21
On parlait déjà de
déploiementcontinu
http://thoughtworks.fileburst.com/assets/technology-radar-april-2010.pdf
Technology Radar ThoughtWorks
Avril 2010
Les tests automatisés et le TDD sont sortis
du radar depuis longtemps!
Même année queSubversion !?!!
Hem……… sérieux ???
![Page 21: Introduction aux tests automatisés et au TDD · « Practices like TDD and BDD are widespread and applied almost unquestionably.It has been a while since I’veseen teams that do](https://reader034.vdocuments.us/reader034/viewer/2022042913/5f4c18b436f5b16eea00f592/html5/thumbnails/21.jpg)
« Practices like TDD and BDD are widespread and applied almost unquestionably. It has been a while since I’ve seen teams that do not have considerable tests at the lower levels (unit,
integration, component). »
-- Fabio Pereira, ThoughtWorks, USA
https://www.thoughtworks.com/insights/blog/introducing-software-testing-cupcake-anti-pattern?utm_campaign=software-testing&utm_medium=social&utm_source=twitter
![Page 22: Introduction aux tests automatisés et au TDD · « Practices like TDD and BDD are widespread and applied almost unquestionably.It has been a while since I’veseen teams that do](https://reader034.vdocuments.us/reader034/viewer/2022042913/5f4c18b436f5b16eea00f592/html5/thumbnails/22.jpg)
23
![Page 23: Introduction aux tests automatisés et au TDD · « Practices like TDD and BDD are widespread and applied almost unquestionably.It has been a while since I’veseen teams that do](https://reader034.vdocuments.us/reader034/viewer/2022042913/5f4c18b436f5b16eea00f592/html5/thumbnails/23.jpg)
24Pourcentages selon Google.
La pyramide !
Bouten bout
Service
Unitaire
% du portfolio de tests Large
(L)
Moyen (M)
Petit (S)
~10%
~20%
~70%
![Page 24: Introduction aux tests automatisés et au TDD · « Practices like TDD and BDD are widespread and applied almost unquestionably.It has been a while since I’veseen teams that do](https://reader034.vdocuments.us/reader034/viewer/2022042913/5f4c18b436f5b16eea00f592/html5/thumbnails/24.jpg)
Ce que l’on a généralement…
Image de stevendepolo sur Flickr 25
Tests de haut niveau lourds, exhaustifs et
utilisant la BD
Tests unitaires…
![Page 25: Introduction aux tests automatisés et au TDD · « Practices like TDD and BDD are widespread and applied almost unquestionably.It has been a while since I’veseen teams that do](https://reader034.vdocuments.us/reader034/viewer/2022042913/5f4c18b436f5b16eea00f592/html5/thumbnails/25.jpg)
Fragilité !
Image par Gamma-Ray Productions sur Flickr
Ce qui vous attend au détour!
Danger!
On ne rigole pas…
![Page 26: Introduction aux tests automatisés et au TDD · « Practices like TDD and BDD are widespread and applied almost unquestionably.It has been a while since I’veseen teams that do](https://reader034.vdocuments.us/reader034/viewer/2022042913/5f4c18b436f5b16eea00f592/html5/thumbnails/26.jpg)
Types versus niveaux
27
Niveaux Types
Classement par la portée
Exemples: Petit / Moyen / Large
Classement par l’objectif du test
Exemples: Unitaire / Bordure / Fonctionnalité / …
![Page 27: Introduction aux tests automatisés et au TDD · « Practices like TDD and BDD are widespread and applied almost unquestionably.It has been a while since I’veseen teams that do](https://reader034.vdocuments.us/reader034/viewer/2022042913/5f4c18b436f5b16eea00f592/html5/thumbnails/27.jpg)
Un test est une sonde!Placez-la judicieusement…
![Page 28: Introduction aux tests automatisés et au TDD · « Practices like TDD and BDD are widespread and applied almost unquestionably.It has been a while since I’veseen teams that do](https://reader034.vdocuments.us/reader034/viewer/2022042913/5f4c18b436f5b16eea00f592/html5/thumbnails/28.jpg)
ExemplesTests de Story
Tests A/BExpérience utilisateur
Simulations
Tests exploratoiresTests de flots de travail
Tests d'utilisabilitéUAT (par l'utilisateur)
Tests unitaires (type)Tests développeurs
Tests de composantes
Tests de performanceTests de charge et capacité
Tests de sécuritéAttributs de qualité (...ilities)
Types de tests
Tiré du livre More Agile Testing
Les types de tests…
Orienté AFFAIRES
Orienté TECHNOLOGIE
Gu
ide
le D
ÉVEL
OP
PEM
ENT
Critiq
ue le P
RO
DU
IT
![Page 29: Introduction aux tests automatisés et au TDD · « Practices like TDD and BDD are widespread and applied almost unquestionably.It has been a while since I’veseen teams that do](https://reader034.vdocuments.us/reader034/viewer/2022042913/5f4c18b436f5b16eea00f592/html5/thumbnails/29.jpg)
30
![Page 30: Introduction aux tests automatisés et au TDD · « Practices like TDD and BDD are widespread and applied almost unquestionably.It has been a while since I’veseen teams that do](https://reader034.vdocuments.us/reader034/viewer/2022042913/5f4c18b436f5b16eea00f592/html5/thumbnails/30.jpg)
Selon vous, qu’est-ce qu’un
test unitaire ?
31
![Page 31: Introduction aux tests automatisés et au TDD · « Practices like TDD and BDD are widespread and applied almost unquestionably.It has been a while since I’veseen teams that do](https://reader034.vdocuments.us/reader034/viewer/2022042913/5f4c18b436f5b16eea00f592/html5/thumbnails/31.jpg)
32
Unité
32
![Page 32: Introduction aux tests automatisés et au TDD · « Practices like TDD and BDD are widespread and applied almost unquestionably.It has been a while since I’veseen teams that do](https://reader034.vdocuments.us/reader034/viewer/2022042913/5f4c18b436f5b16eea00f592/html5/thumbnails/32.jpg)
Un test unitaire est isolé, isolé et encore isolé
Théoriquement une seule classe !
Test unitaire
33
![Page 33: Introduction aux tests automatisés et au TDD · « Practices like TDD and BDD are widespread and applied almost unquestionably.It has been a while since I’veseen teams that do](https://reader034.vdocuments.us/reader034/viewer/2022042913/5f4c18b436f5b16eea00f592/html5/thumbnails/33.jpg)
Les tests unitaires constituent
le niveau le plus bas et le plus isolé pour
réaliser un test
Niveaux de test…
34
Large
Moyen
PetitVous êtes ICI
![Page 34: Introduction aux tests automatisés et au TDD · « Practices like TDD and BDD are widespread and applied almost unquestionably.It has been a while since I’veseen teams that do](https://reader034.vdocuments.us/reader034/viewer/2022042913/5f4c18b436f5b16eea00f592/html5/thumbnails/34.jpg)
35
![Page 35: Introduction aux tests automatisés et au TDD · « Practices like TDD and BDD are widespread and applied almost unquestionably.It has been a while since I’veseen teams that do](https://reader034.vdocuments.us/reader034/viewer/2022042913/5f4c18b436f5b16eea00f592/html5/thumbnails/35.jpg)
36
Cycle du TDD
36
Écrire un test qui échoue
Faire passer le
testRéusiner
1
2
1
![Page 36: Introduction aux tests automatisés et au TDD · « Practices like TDD and BDD are widespread and applied almost unquestionably.It has been a while since I’veseen teams that do](https://reader034.vdocuments.us/reader034/viewer/2022042913/5f4c18b436f5b16eea00f592/html5/thumbnails/36.jpg)
37
Petite
démonstration
![Page 37: Introduction aux tests automatisés et au TDD · « Practices like TDD and BDD are widespread and applied almost unquestionably.It has been a while since I’veseen teams that do](https://reader034.vdocuments.us/reader034/viewer/2022042913/5f4c18b436f5b16eea00f592/html5/thumbnails/37.jpg)
38
Le TDD n’est pas un type ou un niveau de test!
![Page 38: Introduction aux tests automatisés et au TDD · « Practices like TDD and BDD are widespread and applied almost unquestionably.It has been a while since I’veseen teams that do](https://reader034.vdocuments.us/reader034/viewer/2022042913/5f4c18b436f5b16eea00f592/html5/thumbnails/38.jpg)
Le TDD est…
une discipline !
![Page 39: Introduction aux tests automatisés et au TDD · « Practices like TDD and BDD are widespread and applied almost unquestionably.It has been a while since I’veseen teams that do](https://reader034.vdocuments.us/reader034/viewer/2022042913/5f4c18b436f5b16eea00f592/html5/thumbnails/39.jpg)
« TDD is not about validating systems. It is about writing better software. »
-- Tim Ottinger
Ce n’est pas une technique de validation…
![Page 40: Introduction aux tests automatisés et au TDD · « Practices like TDD and BDD are widespread and applied almost unquestionably.It has been a while since I’veseen teams that do](https://reader034.vdocuments.us/reader034/viewer/2022042913/5f4c18b436f5b16eea00f592/html5/thumbnails/40.jpg)
« Testing as a development tool »
-- Startup Lab workshop: Test-Driven Design
https://www.youtube.com/watch?v=AyvYRWWmYSI
Le TDD c’est bien plus qu’une technique de test!
41
![Page 41: Introduction aux tests automatisés et au TDD · « Practices like TDD and BDD are widespread and applied almost unquestionably.It has been a while since I’veseen teams that do](https://reader034.vdocuments.us/reader034/viewer/2022042913/5f4c18b436f5b16eea00f592/html5/thumbnails/41.jpg)
42
Le TDD fait pressionsur le design…
![Page 42: Introduction aux tests automatisés et au TDD · « Practices like TDD and BDD are widespread and applied almost unquestionably.It has been a while since I’veseen teams that do](https://reader034.vdocuments.us/reader034/viewer/2022042913/5f4c18b436f5b16eea00f592/html5/thumbnails/42.jpg)
C’est amusant!!
Pourquoi est-ce que je fais du TDD?
43
![Page 43: Introduction aux tests automatisés et au TDD · « Practices like TDD and BDD are widespread and applied almost unquestionably.It has been a while since I’veseen teams that do](https://reader034.vdocuments.us/reader034/viewer/2022042913/5f4c18b436f5b16eea00f592/html5/thumbnails/43.jpg)
Qualité
Le code fonctionne
Limiter les régressions
Design
Pouvoir réusiner
Avoir de la documentation (synchronisée)
Avoir une meilleure
architecture
Affaires
Avoir une rétroaction
rapide
Répondre aux besoins
Tiré de Startup Lab workshop: Test-Driven Design
https://www.youtube.com/watch?v=AyvYRWWmYSI
Pourquoi l’entreprise veut-elle faire du TDD?
44
![Page 44: Introduction aux tests automatisés et au TDD · « Practices like TDD and BDD are widespread and applied almost unquestionably.It has been a while since I’veseen teams that do](https://reader034.vdocuments.us/reader034/viewer/2022042913/5f4c18b436f5b16eea00f592/html5/thumbnails/44.jpg)
45
![Page 45: Introduction aux tests automatisés et au TDD · « Practices like TDD and BDD are widespread and applied almost unquestionably.It has been a while since I’veseen teams that do](https://reader034.vdocuments.us/reader034/viewer/2022042913/5f4c18b436f5b16eea00f592/html5/thumbnails/45.jpg)
Le défi moderne…
La maintenabilité !
46
![Page 46: Introduction aux tests automatisés et au TDD · « Practices like TDD and BDD are widespread and applied almost unquestionably.It has been a while since I’veseen teams that do](https://reader034.vdocuments.us/reader034/viewer/2022042913/5f4c18b436f5b16eea00f592/html5/thumbnails/46.jpg)
La pourriture du code n’est pas une « loi naturelle »…
47
?
![Page 47: Introduction aux tests automatisés et au TDD · « Practices like TDD and BDD are widespread and applied almost unquestionably.It has been a while since I’veseen teams that do](https://reader034.vdocuments.us/reader034/viewer/2022042913/5f4c18b436f5b16eea00f592/html5/thumbnails/47.jpg)
48
Tanné de stresser pour une
livraison, de débogger, d’avoir peur de briser?
![Page 48: Introduction aux tests automatisés et au TDD · « Practices like TDD and BDD are widespread and applied almost unquestionably.It has been a while since I’veseen teams that do](https://reader034.vdocuments.us/reader034/viewer/2022042913/5f4c18b436f5b16eea00f592/html5/thumbnails/48.jpg)
49 49
S.v.p. donnez-moi un nouveau projet
!@/$%!/%
![Page 49: Introduction aux tests automatisés et au TDD · « Practices like TDD and BDD are widespread and applied almost unquestionably.It has been a while since I’veseen teams that do](https://reader034.vdocuments.us/reader034/viewer/2022042913/5f4c18b436f5b16eea00f592/html5/thumbnails/49.jpg)
Maintenant vous pouvez rénover !
![Page 50: Introduction aux tests automatisés et au TDD · « Practices like TDD and BDD are widespread and applied almost unquestionably.It has been a while since I’veseen teams that do](https://reader034.vdocuments.us/reader034/viewer/2022042913/5f4c18b436f5b16eea00f592/html5/thumbnails/50.jpg)
51
Merci !
![Page 51: Introduction aux tests automatisés et au TDD · « Practices like TDD and BDD are widespread and applied almost unquestionably.It has been a while since I’veseen teams that do](https://reader034.vdocuments.us/reader034/viewer/2022042913/5f4c18b436f5b16eea00f592/html5/thumbnails/51.jpg)
52
Mer
ciNotre siteelapsetech.com
Notre bloguedeveloppementagile.com
Nos Twitter@fbourbonnais | @elapsetech
Mon LinkedInlinkedin.com/in/fbourbonnais/fr
conferences.elapsetech.com
Diapositives
Nos présentations, chez vous!