iut agile lyon 20 nov. 2013 - bdd

31
Behaviour-Driven Development IUT Agile Lyon - 20 nov. 2013 @agnes_crepet @AlfredAlmendra

Upload: agnescrepet

Post on 20-Aug-2015

555 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Iut agile lyon   20 nov. 2013 - bdd

Behaviour-Driven Development

IUT Agile Lyon - 20 nov. 2013

@agnes_crepet

@AlfredAlmendra

Page 2: Iut agile lyon   20 nov. 2013 - bdd

@[email protected]

Java/JEE Architecte & Java Champion Laboratoires Boiron Ninja Squad Java User Groups Leader:

Duchess FranceLyonJUG

Co-fondatrice de la conférence

Agnès CREPET

Page 3: Iut agile lyon   20 nov. 2013 - bdd

@[email protected]

Freelance

Scrum Master Coach agile Développeur Java CARA Lyon

Alfred Almendra

Page 4: Iut agile lyon   20 nov. 2013 - bdd

Acronymes

Page 5: Iut agile lyon   20 nov. 2013 - bdd

Spécification par l’exemple

Spécification exécutable

Page 6: Iut agile lyon   20 nov. 2013 - bdd

BDD : origine(s)

TDDTest Driven Development

Page 7: Iut agile lyon   20 nov. 2013 - bdd
Page 8: Iut agile lyon   20 nov. 2013 - bdd

BDD : origine(s)

USDDUser Story Driven Development

Page 9: Iut agile lyon   20 nov. 2013 - bdd

BDD vs TDD

BDD parle un langage du métier, écrit en texte

TDD parle un langage technique, écrit en code

Complémentaires et non en conflit !

Page 10: Iut agile lyon   20 nov. 2013 - bdd

BDD vs ATDD

ATDD est un paradigme générique d’automatisation des tests d’acceptation

BDD permet d’automatiser les tests, en mettant l’accent sur la communication

Page 11: Iut agile lyon   20 nov. 2013 - bdd

BDD : origine(s)

DDDDomain Driven Design

Page 12: Iut agile lyon   20 nov. 2013 - bdd

BDD : origine(s)

Dan North

Tester c’est décrire le

comportement

Un langageuniversel c’est la

clef

Automatiser les testsd’acceptation

Toute exigencedeviendra un

comportement

Page 13: Iut agile lyon   20 nov. 2013 - bdd

BDD : pourquoi ? quels bénéfices ?

Visibilité sur l’avancement

Critère DONE

Démo réussie

Validation du but de l’itération

Acceptation du produit

Couverture des tests fonctionnels

Non régression

Etude d’impact

Page 14: Iut agile lyon   20 nov. 2013 - bdd

BDD : quoi ?

Point de vue des utilisateurs finaux

DEMO :

CRAFTSMAN

PLAN

Page 15: Iut agile lyon   20 nov. 2013 - bdd

BDD : quoi ?

Boîte noire

Aux frontières du système

On ne décrit pas le comment

Page 16: Iut agile lyon   20 nov. 2013 - bdd

BDD : quoi ?

Décrire le comportementet non pas le fonctionnement

Page 17: Iut agile lyon   20 nov. 2013 - bdd

BDD : quoi ?

Langage commun

Ubiquitous languagede DDD

Page 18: Iut agile lyon   20 nov. 2013 - bdd

BDD : clés de la réussite

Découpagepriorisationcycle itératif et incrémental

Point de vuede l’utilisateurCollaboration

Intégration continue

Test First !

Page 19: Iut agile lyon   20 nov. 2013 - bdd

Exemple avec should

Page 20: Iut agile lyon   20 nov. 2013 - bdd

Exemple avec GherkinGiven the distance max is 50 km per day And I meet M John on “20/11/13” 10 km away And I meet Ms Shelp on “20/11/13” 12 km awayWhen I try to meet M Bob on “20/11/13” 8 km away Then I still have only 2 appointements on “20/11/13”

Structure de test → 1 méthode par step

Page 21: Iut agile lyon   20 nov. 2013 - bdd

BDD : quand ?Découper

Estimer

S’engager

Coder Démontrer

UtiliserPréciser

Page 22: Iut agile lyon   20 nov. 2013 - bdd

BDD From Scratch

Code

Spec

Test

Comment démarrer de zéro ?

Page 23: Iut agile lyon   20 nov. 2013 - bdd
Page 24: Iut agile lyon   20 nov. 2013 - bdd

RAD : Rapid Application Development

Exploration & émergence ⇒ refactoring

Make

Fake

Fake Make

Make

1 2Make

IHM

BdD

Métier

Page 25: Iut agile lyon   20 nov. 2013 - bdd

Double loop TDD

Acceptance Test loop Unit Test loops

Refactor

Fail

Pass

Page 26: Iut agile lyon   20 nov. 2013 - bdd

Maintenance BDD

Versionning des spécifications

?Refactoring des spécifications

Poser les bonnes questions

Etude d’impact

Expérimentation d’alternatives

Page 27: Iut agile lyon   20 nov. 2013 - bdd

BDD sur du legacy

Legacy = non testé (automatiquement !)

On ajoute du BDD sur une application existante→ Non intrusif

Une nouvelle partie fonctionnelle : ok (serein)Une adaptation : impact ? effets de bords ?Une refonte : couverture en tests fonctionnels ?

Page 28: Iut agile lyon   20 nov. 2013 - bdd

Retours terrain

Pas à pas : User Story, scénario d’acceptationTest First : discipline, paradigme

Test ? scénario, méthode, exécution, step

Gherkin : pas pour le métier, dur pour l’analysteStructuration d’un scénario en français : ok

Ne remplace pas : tests “après”, recette intégrée

Page 29: Iut agile lyon   20 nov. 2013 - bdd

As a conclusion...

Page 30: Iut agile lyon   20 nov. 2013 - bdd

Ressources

Un exemple BDD avec cucumber-JVM:https://github.com/acrepet/craftsmanplan

Le blog de Dan North:http://dannorth.net

Page 31: Iut agile lyon   20 nov. 2013 - bdd