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
0
1.3k
Test-driven development with PHPUnit
Oliver Klee
June 23, 2018
Tweet
Share
More Decks by Oliver Klee
See All by Oliver Klee
Gewaltfreie Kommunikation: ein Crashkurs
oliverklee
0
98
Team-Management-Plattform
oliverklee
0
73
Vertrauen in Teams & Führung
oliverklee
0
290
Software-Qualität von TYPO3-Extensions automatisieren
oliverklee
0
50
Vertrauen in Teams & Führung
oliverklee
0
160
Testing von TYPO3-Extensions
oliverklee
0
89
Software-Qualität von Extensions automatisieren
oliverklee
1
58
Content-Synchronisierung
oliverklee
0
170
Gewaltfreie Kommunikation: ein Crashkurs
oliverklee
0
340
Other Decks in Technology
See All in Technology
AI時代の「本当の」ハイブリッドクラウド — エージェントが実現した、あの頃の夢
ebibibi
0
150
脳内メモリ、思ったより揮発性だった
koutorino
0
390
今のWordPress の制作手法ってなにがあんねん?(改) / What’s the Deal with WordPress Development These Days?
tbshiki
0
520
俺の/私の最強アーキテクチャ決定戦開催 ― チームで新しいアーキテクチャに適合していくために / 20260322 Naoki Takahashi
shift_evolve
PRO
0
300
会社紹介資料 / Sansan Company Profile
sansan33
PRO
16
410k
ABEMAのバグバウンティの取り組み
kurochan
1
140
「お金で解決」が全てではない!大規模WebアプリのCI高速化 #phperkaigi
stefafafan
4
1.8k
猫でもわかるKiro CLI(AI 駆動開発への道編)
kentapapa
0
270
2026年もソフトウェアサプライチェーンのリスクに立ち向かうために / Product Security Square #3
flatt_security
1
700
Google系サービスで文字起こしから勝手にカレンダーを埋めるエージェントを作った話
risatube
0
200
Claude Code 2026年 最新アップデート
oikon48
14
11k
20260321_エンベディングってなに?RAGってなに?エンベディングの説明とGemini Embedding 2 の紹介
tsho
0
130
Featured
See All Featured
Done Done
chrislema
186
16k
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
350
Chasing Engaging Ingredients in Design
codingconduct
0
150
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.1k
The Limits of Empathy - UXLibs8
cassininazir
1
270
Abbi's Birthday
coloredviolet
2
5.5k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
100
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
0
160
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
390
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
1
1.3k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
122
21k
Imperfection Machines: The Place of Print at Facebook
scottboms
269
14k
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