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
41
Vertrauen in Teams & Führung
oliverklee
0
190
Software-Qualität von TYPO3-Extensions automatisieren
oliverklee
0
20
Vertrauen in Teams & Führung
oliverklee
0
130
Testing von TYPO3-Extensions
oliverklee
0
39
Software-Qualität von Extensions automatisieren
oliverklee
1
31
Content-Synchronisierung
oliverklee
0
120
Gewaltfreie Kommunikation: ein Crashkurs
oliverklee
0
260
Motivationspsychologie und Gamification in Non-Profit-Organisationen
oliverklee
0
160
Other Decks in Technology
See All in Technology
從四件事帶你見識見識 事件驅動架構設計 (EDA)
line_developers_tw
PRO
0
570
Securing your Lambda 101
chillzprezi
0
300
Copilot Agentを普段使いしてわかった、バックエンド開発で使えるTips
ykagano
1
1.3k
成立するElixirの再束縛(再代入)可という選択
kubell_hr
0
480
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
51
30k
Long journey of Continuous Delivery at Mercari
hisaharu
1
230
OpenTelemetry Collector internals
ymotongpoo
5
560
上長や社内ステークホルダーに対する解像度を上げて、より良い補完関係を築く方法 / How-to-increase-resolution-and-build-better-complementary-relationships-with-your-bosses-and-internal-stakeholders
madoxten
13
7.9k
Amplifyとゼロからはじめた AIコーディング 成果と展望
mkdev10
1
320
SFTPコンテナからファイルをダウンロードする
dip
0
470
ObsidianをMCP連携させてみる
ttnyt8701
2
130
Azure AI Foundryでマルチエージェントワークフロー
seosoft
0
120
Featured
See All Featured
How to Ace a Technical Interview
jacobian
276
23k
KATA
mclloyd
29
14k
Balancing Empowerment & Direction
lara
1
320
The Power of CSS Pseudo Elements
geoffreycrofte
77
5.8k
Optimizing for Happiness
mojombo
379
70k
Fantastic passwords and where to find them - at NoRuKo
philnash
51
3.3k
A Modern Web Designer's Workflow
chriscoyier
693
190k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
53k
Site-Speed That Sticks
csswizardry
10
640
Designing Experiences People Love
moore
142
24k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
8
780
Adopting Sorbet at Scale
ufuk
77
9.4k
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