Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Testing sur Legacy Code
Search
Jean-Laurent de Morlhon
November 20, 2013
Programming
81
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Testing sur Legacy Code
Jean-Laurent de Morlhon
November 20, 2013
More Decks by Jean-Laurent de Morlhon
See All by Jean-Laurent de Morlhon
Retour Sur DockerCon 2016 - Docker Mega Meetup
jeanlaurent
1
140
Retour sur DockerCon 2016
jeanlaurent
2
230
Pourquoi Maurice ne doit surtout pas coder en Go.
jeanlaurent
0
200
Diamond Kata Workshop
jeanlaurent
0
210
Testing sur code legacy
jeanlaurent
0
140
FruitShop
jeanlaurent
3
880
Phantom, Zombie & Karma, overview of the greatest testing tools for modern web app
jeanlaurent
5
790
Live Coding Tester une Application HTML5
jeanlaurent
1
110
Le fantome, le zombie et testacular Karma. Panorama des outils de tests pour application web moderne.
jeanlaurent
1
110
Other Decks in Programming
See All in Programming
GraphQL の onError と Nullability のこれから
quramy
0
210
Spec-driven Development with AI
simas
PRO
0
2.3k
flutter_test のその先へ — Flutter アプリの LLM 機能に「評価」という品質保証を
kosukesaigusa
0
200
React Native経験者が Flutterを30⽇間触って驚いたこと
3saito
0
160
Coding with AI: How to trust the storyteller (AWS Community Day Adria, Ljubljana 2026)
slobodan
0
140
プロジェクトコードをキレイキレイしよう!暗黙的な参照を読み解く静的解析
ostk0069
0
210
小さなアプリを作って公開するまで
onozaty
0
150
AIで開発が速くなった先で、開発チームは何を目指すか
shihochan
1
2k
TanStack Vue Query と Pinia Colada から学ぶ非同期状態の型設計
aoshi
0
630
Vue.jsで作る空間解析アプリとCapacitorプラグインのData Bridge
hal_spidernight
1
170
作れる、でも消せるか?──安全に「枯らして消す」機能削除術 / Drain, Then Delete
chobishiba
3
1.5k
Lambda durable functionsでHuman in the Loopを楽に…楽に……
har1101
2
290
Featured
See All Featured
Leo the Paperboy
mayatellez
10
2.4k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.7k
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.8k
Mobile First: as difficult as doing things right
swwweet
225
10k
How to Think Like a Performance Engineer
csswizardry
28
2.9k
SEO for Brand Visibility & Recognition
aleyda
0
4.9k
Prompt Engineering for Job Search
mfonobong
0
580
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
820
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
230
23k
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
560
Darren the Foodie - Storyboard
khoart
PRO
4
4.1k
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.7k
Transcript
TESTING SUR CODE LEGACY Jean-Laurent de Morlhon
WHO'S WHO ? Nom & rôle dans votre entreprise ?
Expérience professionnelle ? Votre niveau en testing sur du code legacy ?
AGENDA Présentation Craftsmanship Testing & Legacy Gilded Rose Legacy Code
Refactoring WrapUp 4 % 4 % 12 % 24 % 48 % 8 % Présentation Craftsmanship Testing & Legacy Gilded Rose Mayhem Wrap Up
CRAFTSMANSHIP
Process Coding CRAFTSMANSHIP
Attitude
MENTORING & TRAINING
TESTING & LEGACY
None
TAXONOMIE DES TESTS Tests unitaires Tests d'intégrations e2e Tests de
performance Tests de charge Tests exploratoires Tests d'ergonomie Automatisées manuels
TEST UNITAIRE @Test public void should_find_winning_bids_when_there_is_option_bids() { Bid bid =
new Bid(); bid.setStatus(OPTION); ExpiredBids expiredBids = new ExpiredBids(); expiredBids.add(bid); assertThat(expiredBids.isAnyWinning()).isTrue(); } Test très technique Teste une classe en isolation des autres Ultra rapide (< 10ms)
TEST D'INTÉGRATION Test souvent technique Teste le comportement de plusieurs
composants ensemble Rapide à lent ( 500ms ~ 1s) @Test public void i_can_retrieve_auctions_bided_by_an_investor() { Investor investor = investors.add(buildInvestor()); Auction auction = auctions.add(buildAuction()); auctions.addBidToAuction(auction.getId(), buildBid()); assertThat(auctions.fromInvestors(investor.get_id())).isNotEmpty(); }
TEST END 2 END Test souvent fonctionnel Teste toute l'application,
souvent via l'interface Lent (+1s) it 'should find my company account from siren', (done) -> browser = new Browser() browser.visit home, -> browser.clickLink 'Inscrivez-vous', -> browser.choose 'une entreprise' browser.pressButton 'Envoyer', -> browser.fill 'sirenCode', '394149496' browser.clickLink 'Rechercher', -> expect(browser.evaluate('$(\'input[name="e"]\').val()')).to.equal 'SERPODILE' done()
TECHNIQUES
TEST "AFTER" J'écris du code J'écris un test qui couvre
le code que je viens d'écrire du mieux que je peux. Facile à faire Génère des tests d'intégrations Tests souvent compliqués.
TDD Ecrire un test unitaire qui échoue Faire passer le
test simplement Refactor Switch de clavier
TECHNIQUE OUTSIDE-IN Ecrire un test d'acceptance qui échoue Ecrire un
test unitaire qui échoue Faire passer le test simplement Refactor
BDD - TDD WITH STYLE Scenario: substract two numbers Given
I have entered 10 in the calculator And I have entered 7 in the calculator When I press substract Then the result should be 3 on the screen
LEGACY CODE ? Un système en production Manque de maintenance
Manque de tests Customization Locking Pas de source
PYRAMIDE DES TESTS Tests unitaires Tests d'intégrations e2e 1-5% 5-15%
80-90% + - Temps Complexité Fragilité
PYRAMIDE DES TESTS 0-5% 5-15% 80-90% + - Temps Complexité
Fragilité e2e Tests d'intégrations Tests unitaires
INVERSER LA PYRAMIDE e2e Tests d'intégrations Tests unitaires Tests unitaires
Tests d'intégrations e2e Système legacy Système sous contrôle
INVERSER LA PYRAMIDE 4 règles du design simple Attitude Boy
Scout Rule Appropriation collective du code Politique de tests Design émergent
4 RÈGLES DU DESIGN SIMPLE 1. Tous les tests passent
2. Révèle ton intention 3. Evite la duplication 4. Petites classes & petites méthodes
FENETRE CASSEE
PAIR PROGRAMMING
DESIGN EMERGENT
RÈGLE DU BOY SCOUT
TOUT EST LIÉ
CODE
GILDED ROSE https://github.com/xebia-france/gildedrose-kata Exercice de refactoring sur legacy Par binôme
Tentez une technique Vous êtes la pour expérimenter, apprendre Pas pour "gagner" l'exercice. Niveau: moyen 1h30
MAYHEM https://github.com/jeanlaurent/devoxx-legacy-code-labs MAY-HEM: A state of violent disorder or riotous
confusion; havoc 3h Exercice de refactoring sur legacy Par binôme Niveau: difficile
UN PEU DE LECTURE
CONTACT
[email protected]
@morlhon http://code-story.net http://morlhon.net/blog