Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Behat - retour d'expérience
Search
Marek Kalnik
November 22, 2013
Programming
1
430
Behat - retour d'expérience
Le talk sur Behat sur un projet de 15 devs, que j'ai donnée au ForumPHP 2013.
Marek Kalnik
November 22, 2013
Tweet
Share
More Decks by Marek Kalnik
See All by Marek Kalnik
Ma liste subjective des 10 développeurs à connaitre
marekkalnik
0
77
Le management LEAN
marekkalnik
0
76
Versioning mobile apps and apis
marekkalnik
0
94
Comment Ionic vous aide
marekkalnik
0
150
Pourquoi choisir Ionic ?
marekkalnik
0
270
Cordova vs. Steroids
marekkalnik
0
150
Arrêtons de parler de code de qualité, ce qu'il faut c'est du code agile !
marekkalnik
2
640
Code Agile - comment redéfinir la qualité
marekkalnik
2
190
Write your jQuery in console
marekkalnik
0
180
Other Decks in Programming
See All in Programming
AI時代のキャリアプラン「技術の引力」からの脱出と「問い」へのいざない / tech-gravity
minodriven
21
7.2k
AI Schema Enrichment for your Oracle AI Database
thatjeffsmith
0
290
Automatic Grammar Agreementと Markdown Extended Attributes について
kishikawakatsumi
0
190
AWS re:Invent 2025参加 直前 Seattle-Tacoma Airport(SEA)におけるハードウェア紛失インシデントLT
tetutetu214
2
110
AI時代の認知負荷との向き合い方
optfit
0
160
Fluid Templating in TYPO3 14
s2b
0
130
コマンドとリード間の連携に対する脅威分析フレームワーク
pandayumi
1
450
AtCoder Conference 2025
shindannin
0
1.1k
FOSDEM 2026: STUNMESH-go: Building P2P WireGuard Mesh Without Self-Hosted Infrastructure
tjjh89017
0
170
Patterns of Patterns
denyspoltorak
0
1.4k
ノイジーネイバー問題を解決する 公平なキューイング
occhi
0
100
AgentCoreとHuman in the Loop
har1101
5
240
Featured
See All Featured
The Language of Interfaces
destraynor
162
26k
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
320
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.3k
Site-Speed That Sticks
csswizardry
13
1.1k
Faster Mobile Websites
deanohume
310
31k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
7.9k
Fireside Chat
paigeccino
41
3.8k
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
450
A Tale of Four Properties
chriscoyier
162
24k
Why Our Code Smells
bkeepers
PRO
340
58k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
2
420
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Transcript
Forum PHP Paris 2013, 22 Nov. 2013 retour d'expérience Behat
Hello !
Je m’appelle Marek
Viser le déploiement continu Behat : écrire les tests en
«humain» Réussir la mise en place de Behat Je vais vous parler de...
Dans l'économie d'aujourd'hui les rapides mangent les lents
le Time To Market est souvent ralenti par la phase
de tests
Comment font les grands ?
30 déploiements par jour
7.000 tests
2 déploiements par jour
une suite de tests fonctionnels lancée à chaque fois
We need to release new features faster and with good
quality Alan Faulkner, Test Engineer
« Right now, with the role I am in, I
spend less than 5% of my time doing manual testing » Alan Faulkner, Test Engineer
None
Un processus d'intégration continue permet de limiter les risques
être comme Google, Facebook, Etsy coder vite déployer vite déployer
sans risque
Viser le déploiement continu Behat : écrire les tests en
«humain» Réussir la mise en place de Behat
pourquoi Behat
parce que c'est cool !
comment maintenir 7000 tests ? comment impliquer le métier dans
les tests ? comment relier le business et les tests ?
Feature: Services Scenario: #10322 : an anonymous user can't see
the author's last name Given I am an anonymous user with my city registered When I go to the "service list" page Then I don't see the author's last name framework de tests en « langage naturel »
website feature framework de tests multi-niveaux context
framework de tests de grande taille PHPUnit Test d'intégration PHPUnit
Behat PHPSpec taille expressivité
Under the hood Given I am an anonymous user with
my city registered regexp match une fonction contexte driver navigateur web
Viser le déploiement continu Behat : écrire les tests en
«humain» Réussir la mise en place de Behat
Paralléliser dès le début 9 minutes 15 juil. 15 nov.
23 minutes 6 minutes 8 minutes seuil d'acceptabilité :-) :-( Règle 1 refactoring
factorisation de tests pour accélérer le build n'est pas efficace
il faut paralléliser pour obtenir des meilleurs résultats Paralléliser dès le début Règle 1
Environnement #serveurs web #workers #machines #cpu Penser infrastructure 2 Règle
Selenium flexible lourd Driver PhantomJS léger rapide cookies Goutte Penser
infrastructure 2 Règle
$ bin/behat -p prod # behat.yml prod: filters: tags: "@prod"
extensions: Behat\MinkExtension\Extension: base_url: http://www.example.org/ Faire une suite de tests dédie à la production 3 Règle
.advert-result .item-advert .body-article h2 a !? Stabiliser les sélecteurs CSS
4 Règle
l'équipe de tests doit se mettre d'accord avec l'équipe intégration
utiliser les ids pour Behat et les classes pour le CSS Stabiliser les sélecteurs CSS 4 Règle
Intégrer un chat dans l'équipe 0 Règle
Spinner... 5 Règle $this->getMainContext()->spin( function ($context) use ($listId) { $context->getMainContext()
->assertSession() ->elementExists('css', '#'.$listId); return true; } );
public function spin($closure, $tries = 15) { for ($i =
0; $i < $tries; $i++) { try { if ($result = $closure($this)) { return true; } } catch (\Exception $e) { // do nothing to continue the loop } usleep(300000); } throw new \Exception( $this->formatBacktrace(debug_backtrace()) ); } Spinner... 5 Règle
Respecter la pyramide de tests 6 Règle big medium small
pas celle-ci Respecter la pyramide de tests 6 Règle big
medium small
5 10 15 20 25 4 8 12 16 20
3 6 9 12 15 2 4 5 8 10 1 2 3 4 6 Impact business Probabilité de régression medium small big Ne pas tout tester 6 Règle ,5
Merci !
et on recrute ;-)
[email protected]
@marekkalnik @theodo