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
20
Vertrauen in Teams & Führung
oliverklee
0
130
Software-Qualität von TYPO3-Extensions automatisieren
oliverklee
0
7
Vertrauen in Teams & Führung
oliverklee
0
87
Testing von TYPO3-Extensions
oliverklee
0
23
Software-Qualität von Extensions automatisieren
oliverklee
1
11
Content-Synchronisierung
oliverklee
0
95
Gewaltfreie Kommunikation: ein Crashkurs
oliverklee
0
220
Motivationspsychologie und Gamification in Non-Profit-Organisationen
oliverklee
0
120
Other Decks in Technology
See All in Technology
ヤプリQA課題の見える化
gu3
0
160
大規模言語モデルとそのソフトウェア開発に向けた応用 (2024年版)
kazato
2
500
三菱電機で社内コミュニティを立ち上げた話
kurebayashi
1
320
SpiderPlus & Co. エンジニア向け会社紹介資料
spiderplus_cb
0
650
ZOZOTOWN の推薦における KPI モニタリング/KPI monitoring for ZOZOTOWN recommendations
rayuron
1
1.1k
OPENLOGI Company Profile for engineer
hr01
1
18k
PHP ユーザのための OpenTelemetry 入門 / phpcon2024-opentelemetry
shin1x1
3
1.7k
3年でバックエンドエンジニアが5倍に増えても破綻しなかったアーキテクチャ そして、これから / Software architecture that scales even with a 5x increase in backend engineers in 3 years
euglena1215
11
4.3k
When Windows Meets Kubernetes…
pichuang
0
270
カップ麺の待ち時間(3分)でわかるPartyRockアップデート
ryutakondo
0
100
生成AI × 旅行 LLMを活用した旅行プラン生成・チャットボット
kominet_ava
0
120
効率的な技術組織が作れる!書籍『チームトポロジー』要点まとめ
iwamot
2
200
Featured
See All Featured
Keith and Marios Guide to Fast Websites
keithpitt
410
22k
Unsuck your backbone
ammeep
669
57k
A Modern Web Designer's Workflow
chriscoyier
693
190k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
3
340
Practical Orchestrator
shlominoach
186
10k
jQuery: Nuts, Bolts and Bling
dougneiner
62
7.6k
Become a Pro
speakerdeck
PRO
26
5.1k
What's in a price? How to price your products and services
michaelherold
244
12k
The Invisible Side of Design
smashingmag
299
50k
Git: the NoSQL Database
bkeepers
PRO
427
64k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
7
560
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5.1k
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