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
27
Vertrauen in Teams & Führung
oliverklee
0
140
Software-Qualität von TYPO3-Extensions automatisieren
oliverklee
0
8
Vertrauen in Teams & Führung
oliverklee
0
97
Testing von TYPO3-Extensions
oliverklee
0
24
Software-Qualität von Extensions automatisieren
oliverklee
1
13
Content-Synchronisierung
oliverklee
0
100
Gewaltfreie Kommunikation: ein Crashkurs
oliverklee
0
230
Motivationspsychologie und Gamification in Non-Profit-Organisationen
oliverklee
0
140
Other Decks in Technology
See All in Technology
転生CISOサバイバル・ガイド / CISO Career Transition Survival Guide
kanny
3
1k
プロセス改善による品質向上事例
tomasagi
2
2.6k
The Future of SEO: The Impact of AI on Search
badams
0
200
なぜ私は自分が使わないサービスを作るのか? / Why would I create a service that I would not use?
aiandrox
0
750
JEDAI Meetup! Databricks AI/BI概要
databricksjapan
0
110
現場の種を事業の芽にする - エンジニア主導のイノベーションを事業戦略に装着する方法 -
kzkmaeda
2
2.1k
データマネジメントのトレードオフに立ち向かう
ikkimiyazaki
6
990
自動テストの世界に、この5年間で起きたこと
autifyhq
10
8.6k
ユーザーストーリーマッピングから始めるアジャイルチームと並走するQA / Starting QA with User Story Mapping
katawara
0
210
Platform Engineeringは自由のめまい
nwiizo
4
2.1k
運用しているアプリケーションのDBのリプレイスをやってみた
miura55
1
730
Developer Summit 2025 [14-D-1] Yuki Hattori
yuhattor
19
6.2k
Featured
See All Featured
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
10
1.3k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
12
960
Intergalactic Javascript Robots from Outer Space
tanoku
270
27k
Practical Orchestrator
shlominoach
186
10k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
7k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
The Invisible Side of Design
smashingmag
299
50k
Imperfection Machines: The Place of Print at Facebook
scottboms
267
13k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
133
33k
[RailsConf 2023] Rails as a piece of cake
palkan
53
5.2k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Large-scale JavaScript Application Architecture
addyosmani
511
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