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
Test-driven development with PHPUnit
Search
Oliver Klee
June 23, 2018
Technology
1.3k
0
Share
Test-driven development with PHPUnit
Oliver Klee
June 23, 2018
More Decks by Oliver Klee
See All by Oliver Klee
Gewaltfreie Kommunikation: ein Crashkurs
oliverklee
0
110
Team-Management-Plattform
oliverklee
0
77
Vertrauen in Teams & Führung
oliverklee
0
310
Software-Qualität von TYPO3-Extensions automatisieren
oliverklee
0
52
Vertrauen in Teams & Führung
oliverklee
0
170
Testing von TYPO3-Extensions
oliverklee
0
95
Software-Qualität von Extensions automatisieren
oliverklee
1
61
Content-Synchronisierung
oliverklee
0
180
Gewaltfreie Kommunikation: ein Crashkurs
oliverklee
0
370
Other Decks in Technology
See All in Technology
生成AIはソフトウェア開発の革命か、ソフトウェア工学の宿題再提出なのか -ソフトウェア品質特性の追加提案-
kyonmm
PRO
2
870
10サービス以上のメール到達率改善を地道に継続的に進めている話 / Continue to improve email delivery rates across multiple services
yamaguchitk333
3
230
OWASP APTSを眺めてみた
su3158
0
130
Shiny New Tools Won't Fix Your Problem
trishagee
1
120
2026年春のAgentCoreアプデ 細かいやつ全部まとめ
minorun365
3
220
「QA=テスト」「シフトレフト=スクラムイベントの参加者の一員」の呪縛を解く。アジャイルな開発を止めないために、10Xで挑んだ「右側のしわ寄せ」解消記 #scrumniigata
nihonbuson
PRO
4
980
QAエンジニアはどうやって プロダクト議論の場に入れるのか?
moritamasami
2
410
生成AI時代に信頼性をどう保ち続けるか - Policy as Code の実践
akitok_
0
180
要件定義の精度を高めるための型と生成AIの活用 / Using Types and Generative AI to Improve the Accuracy of Requirements Definition
haru860
0
310
古今東西SRE
okaru
1
170
変化の激しい時代をゴキゲンに生き抜くために 〜ストレスマネジメントのススメ〜
kakehashi
PRO
5
1.2k
Purview 勉強会報告 Microsoft Purview 入門しようとしてみた
masakichixo
1
250
Featured
See All Featured
We Have a Design System, Now What?
morganepeng
55
8.1k
Between Models and Reality
mayunak
3
280
So, you think you're a good person
axbom
PRO
2
2k
Are puppies a ranking factor?
jonoalderson
1
3.4k
sira's awesome portfolio website redesign presentation
elsirapls
0
230
Speed Design
sergeychernyshev
33
1.6k
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
340
Darren the Foodie - Storyboard
khoart
PRO
3
3.3k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Everyday Curiosity
cassininazir
0
200
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
118
110k
Transcript
Test-driven Development with PHPUnit Oliver Klee, 2018-06 @oliklee
[email protected]
This is Oliver Klee (me!) Workshop teacher •unit testing •extension
development •software quality •saying „no“, consent culture TYPO3 extension developer (wanna-be) singer @oliklee oliverklee oliverklee.de
unterstand TDD become test-infected have fun Workshop goals
Workshop Rules
Stand up for your tests
Workshop roadmap 1. Terms & concepts 2. Testing patterns 3.
Naming things 4. Code katas
Workshop roadmap 1. Terms & concepts 2. Testing patterns 3.
Naming things 4. Code katas
Unit Tests?
Manual testing is cumbersome
Automated testing is fast
Unit tests for the TYPO3 Core
> 4400 tests
< 14 seconds
Verify that your code does what you expect
Make sure that your changes won‘t break anything
Keep others from breaking your code
Don’t break anything even in complex projects
Create a safety net for refactoring or for TYPO3 updates
Improve the structure of your code
Green feels good!
https://github.com/oliverklee/tdd-reader /Exercises/tdd-exercises-en.md
Let’s get some terms straight
The two programming modes clean hacky
Testsuite Testcase Test Assertion Test Test Testcase
The life cycle of a test new FooTest(); setUp(); /**
@test */ lifeIsGood(); tearDown();
4 test phases set up setUp() code in the test
method exercise method call verify assert…() tear down tearDown()
Code test-first write test write code refactor
Workshop roadmap 1. Terms & concepts 2. Testing patterns 3.
Naming things 4. Code katas
Workshop roadmap 1. Terms & concepts 2. Testing patterns 3.
Naming things 4. Code katas
None
https://github.com/oliverklee/tdd-reader /Exercises/tdd-exercises-en.md
Test levels http://filipdefar.com/2015/06/tested-be-thy-name.html
Unit tests are small and fast
Integration tests test how components work together in TYPO3: „functional
tests“
Systemtests test the big picture
Test types
Blackbox tests test the public API
Whitebox tests inner workings test the
Functional tests
Acceptance tests Selenium Codeception
Anti- zombie tests-
Regression tests
Smoke tests
Smoke tests
Story tests for Behavior-driven development (BDD) Behat Codeception
Workshop roadmap 1. Terms & concepts 2. Testing patterns 3.
Naming things 4. Code katas
Workshop roadmap 1. Terms & concepts 2. Testing patterns 3.
Naming things 4. Code katas
Naming Tests
Use meaningful test names classCanBeInstantiated setTitleSetsTitle setSizeWithZeroThrowsException hasTitleForEmptyTitleReturnsFalse Name the
behavior. Name the preconditions. Name the method. Don’t use “works” or “works correctly”. measureFrubbleWorksCorrectly
None
Workshop roadmap 1. Terms & concepts 2. Testing patterns 3.
Naming things 4. Code katas
Workshop roadmap 1. Terms & concepts 2. Testing patterns 3.
Naming things 4. Code katas
None