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
Team-Management-Plattform
oliverklee
0
45
Vertrauen in Teams & Führung
oliverklee
0
200
Software-Qualität von TYPO3-Extensions automatisieren
oliverklee
0
22
Vertrauen in Teams & Führung
oliverklee
0
130
Testing von TYPO3-Extensions
oliverklee
0
45
Software-Qualität von Extensions automatisieren
oliverklee
1
35
Content-Synchronisierung
oliverklee
0
130
Gewaltfreie Kommunikation: ein Crashkurs
oliverklee
0
270
Motivationspsychologie und Gamification in Non-Profit-Organisationen
oliverklee
0
170
Other Decks in Technology
See All in Technology
KCD Lima: eBee in Peru!
lizrice
0
100
FAST導入1年間のふりかえり〜現実を直視し、さらなる進化を求めて〜 / Review of the first year of FAST implementation
wooootack
1
150
MCPと認可まわりの話 / mcp_and_authorization
convto
2
240
OpenTelemetry の Log を使いこなそう
biwashi
5
1k
AWS表彰プログラムとキャリアについて
naoki_0531
1
130
OTel 公式ドキュメント翻訳 PJ から始めるコミュニティ活動/Community activities starting with the OTel official document translation project
msksgm
0
280
TypeScript 上達の道
ysknsid25
21
4.5k
低レイヤソフトウェア技術者が YouTuberとして食っていこうとした話
sat
PRO
7
5.9k
alecthomas/kong はいいぞ
fujiwara3
2
350
20250718_ITSurf_“Bet AI”を支える文化とコストマネジメント
helosshi
1
220
Jitera Company Deck / JP
jitera
0
180
SAE J1939シミュレーション環境構築
daikiokazaki
1
180
Featured
See All Featured
The Art of Programming - Codeland 2020
erikaheidi
54
13k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
53k
Documentation Writing (for coders)
carmenintech
72
4.9k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
8
370
Designing for humans not robots
tammielis
253
25k
Into the Great Unknown - MozCon
thekraken
40
1.9k
A better future with KSS
kneath
238
17k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
130
19k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
2.9k
Side Projects
sachag
455
43k
What's in a price? How to price your products and services
michaelherold
246
12k
Building Applications with DynamoDB
mza
95
6.5k
Transcript
Test-driven Development with PHPUnit Oliver Klee, 2018-06 @oliklee typo3-coding@oliverklee.de
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