Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Test-driven development with PHPUnit
Search
Oliver Klee
August 05, 2022
Programming
420
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Test-driven development with PHPUnit
Oliver Klee
August 05, 2022
More Decks by Oliver Klee
See All by Oliver Klee
Psychologische Sicherheit
oliverklee
0
31
Generative KI, Ethik und Nachhaltigkeit
oliverklee
0
110
Gewaltfreie Kommunikation: ein Crashkurs
oliverklee
0
140
Team-Management-Plattform
oliverklee
0
100
Vertrauen in Teams & Führung
oliverklee
0
330
Software-Qualität von TYPO3-Extensions automatisieren
oliverklee
0
64
Vertrauen in Teams & Führung
oliverklee
0
190
Testing von TYPO3-Extensions
oliverklee
0
110
Software-Qualität von Extensions automatisieren
oliverklee
1
68
Other Decks in Programming
See All in Programming
re:Inventに行く前に知っておきたい現地参加のノウハウ
nokomoro3
0
290
世界の中心で、AI(App Intents)をさけぶ ー App Intents中心設計の実践ガイド
touyou
0
740
setup-vp GitLab対応の裏側
naokihaba
0
140
スマートフォンでモールス信号を送受信する 〜スマートフォンのLEDとカメラで作る光通信の設計と実装〜
atsuki_seo
0
220
Simple Storage Service(S3) is not simple
iwatsukayura
0
120
Security issues being discussed on Web Platforms
petamoriken
0
1.4k
JAWS-UG 東京支部が始める、JAWS-UG支部コラボ / JAWS-UG lunchtime LT Collaboration
y0hgi
0
170
動作中のプログラムの中身をリアルタイムに覗く / Realtime Debugger for CSharp with Roslyn
prota
1
1.7k
Findy - エンジニア向け会社紹介/Findy Company Deck
findyinc
6
400k
Omarchy Tokyo やると聞いて UMPC 買ってセットアップしてきた
mtsmfm
0
200
AI時代のコードレビューは人に向けるな、仕組みに向けろ
texmeijin
5
3.2k
iOSDCのペンライトを自動制御したい!
akkeylab
0
330
Featured
See All Featured
Between Models and Reality
mayunak
4
480
Mobile First: as difficult as doing things right
swwweet
225
10k
The Invisible Side of Design
smashingmag
301
52k
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
590
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
540
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
450
Scaling GitHub
holman
464
140k
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
480
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
440
Git: the NoSQL Database
bkeepers
PRO
432
67k
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
380
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
Transcript
Test-driven development with PHPUnit Oliver Klee, 2022-08 @oliklee
| Mastodon:
[email protected]
|
[email protected]
About me Oliver „Oli“ Klee #bonn #extension-dev #workshop-teacher #unit-testing-guy #phpstan-guy
#typo3-ombudsperson #typo3-quality-assurance-initiative #gami fi cation-working-group #game-cooking #powermetal
???
The goals ✓ You have a clearer understanding on how
TDD works. ✓(optional) You get test-infected. ✓You learn at least 1 new testing pattern. ✓We all have fun.
The travel plan 1. getting starte d 2. concepts &
term s 3. testing pattern s 4. hands-o n 5. naming test s 6. hands-o n 7. ending & feedback
The rules 1. There are no stupid questions. 2. The
joker rule.
The travel plan 1. getting starte d 2. concepts &
term s 3. testing pattern s 4. hands-o n 5. naming test s 6. hands-o n 7. ending & feedback
Unit Tests?
Manual testing is cumbersome
Automated testing is fast
Unit tests for the TYPO3 Core
Unit Tests 406 (144) tests/s
Functional Tests 8.13 (1.97) tests/s
Acceptance Tests .009 (.003) tests/s
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
Find the location of bugs
Green feels good!
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();
Code test-first write test write code refactor
The travel plan 1. getting starte d 2. concepts &
term s 3. testing pattern s 4. hands-o n 5. naming test s 6. hands-o n 7. ending & feedback
The travel plan 1. getting starte d 2. concepts &
term s 3. testing pattern s 4. hands-o n 5. naming test s 6. hands-o n 7. ending & feedback
https://github.com/TYPO3-Documentation/tea/ Branch: workshop/t3dd22 File: Exercises.md
The travel plan 1. getting starte d 2. concepts &
term s 3. testing pattern s 4. hands-o n 5. naming test s 6. hands-o n 7. ending & feedback
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
The travel plan 1. getting starte d 2. concepts &
term s 3. testing pattern s 4. hands-o n 5. naming test s 6. hands-o n 7. ending & feedback