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
430
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
Transcript
34 slides
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
More Decks by Oliver Klee
See All by Oliver Klee
Testing von TYPO3-Extensions
oliverklee
0
34
Softwarequalität für öffentliche TYPO3-Extensions
oliverklee
0
86
Psychologische Sicherheit
oliverklee
0
53
Generative KI, Ethik und Nachhaltigkeit
oliverklee
0
300
Gewaltfreie Kommunikation: ein Crashkurs
oliverklee
0
160
Team-Management-Plattform
oliverklee
0
110
Vertrauen in Teams & Führung
oliverklee
0
340
Software-Qualität von TYPO3-Extensions automatisieren
oliverklee
0
73
Vertrauen in Teams & Führung
oliverklee
0
200
Other Decks in Programming
See All in Programming
はじめてのPLATEAU
nokonoko1203
1
670
Growing PicoRuby's Ecosystem on ESP32
yuuu
2
150
How SRE Grew Out of Server-Side Work and Became the Team's Own / サーバサイドから始まったSREを チームに渡すまで
maaaato
0
170
作れるエンジニアから、価値を届けるエンジニアへ
ryunakayama
1
680
Rails初心者がパスキーを実装してみて大変だったこと
ktombow
0
240
DroidKnights 2026 Android A2UI Jetpack Compose 기반의 안전한 AI UI 렌더링 - 박제창
itsmedreamwalker
1
260
AI駆動開発4年目の現在地(『あなたはFDEになるべきか?』イベント資料)
kumaiu
0
690
조합이폭발하는디자인시스템이걸눈으로도테스트하라고요
giljongyu
0
790
Debian JP Projectのサーバー構成
uwabami
1
170
AppFunctionsの内部実装を紐解く
hiroaki404
0
110
Getting Started with Vibe Coding
miccheng
0
250
RaspberryPi 5で軽くはじめるk3sとtailscaleを用いたホームサーバー構築 (1)
nasum
0
430
Featured
See All Featured
Leading Effective Engineering Teams in the AI Era
addyosmani
9
2.9k
WCS-LA-2024
lcolladotor
0
1k
First, design no harm
axbom
PRO
2
1.4k
The SEO identity crisis: Don't let AI make you average
varn
0
630
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
640
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
620
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
640
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
56
3.5k
The untapped power of vector embeddings
frankvandijk
2
2k
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
690
Between Models and Reality
mayunak
4
600
Large-scale JavaScript Application Architecture
addyosmani
516
110k