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.2k
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
35
Vertrauen in Teams & Führung
oliverklee
0
170
Software-Qualität von TYPO3-Extensions automatisieren
oliverklee
0
15
Vertrauen in Teams & Führung
oliverklee
0
110
Testing von TYPO3-Extensions
oliverklee
0
32
Software-Qualität von Extensions automatisieren
oliverklee
1
21
Content-Synchronisierung
oliverklee
0
110
Gewaltfreie Kommunikation: ein Crashkurs
oliverklee
0
250
Motivationspsychologie und Gamification in Non-Profit-Organisationen
oliverklee
0
150
Other Decks in Technology
See All in Technology
Aspire をカスタマイズしよう & Aspire 9.2
nenonaninu
0
250
OPENLOGI Company Profile for engineer
hr01
1
24k
Linuxのパッケージ管理とアップデート基礎知識
go_nishimoto
0
670
ドキュメント管理の理想と現実
kazuhe
1
260
LiteXとオレオレCPUで作る自作SoC奮闘記
msyksphinz
0
830
Perl歴約10年のエンジニアがフルスタックTypeScriptに出会ってみた
papix
1
210
CodePipelineのアクション統合から学ぶAWS CDKの抽象化技術 / codepipeline-actions-cdk-abstraction
gotok365
5
320
白金鉱業Meetup_Vol.18_生成AIはデータサイエンティストを代替するのか?
brainpadpr
3
190
3D生成AIのための画像生成
kosukeito
2
350
日経電子版 for Android の技術的課題と取り組み(令和最新版)/android-20250423
nikkei_engineer_recruiting
1
520
Oracle Cloud Infrastructure:2025年4月度サービス・アップデート
oracle4engineer
PRO
0
200
Compose におけるパスワード自動入力とパスワード保存
tonionagauzzi
0
120
Featured
See All Featured
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
60k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
30
2k
How GitHub (no longer) Works
holman
314
140k
Raft: Consensus for Rubyists
vanstee
137
6.9k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
178
53k
A Modern Web Designer's Workflow
chriscoyier
693
190k
A better future with KSS
kneath
239
17k
[RailsConf 2023] Rails as a piece of cake
palkan
54
5.4k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
3.8k
Faster Mobile Websites
deanohume
306
31k
Reflections from 52 weeks, 52 projects
jeffersonlam
349
20k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
357
30k
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