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.1k
Test-driven development with PHPUnit
Oliver Klee
June 23, 2018
Tweet
Share
More Decks by Oliver Klee
See All by Oliver Klee
Content-Synchronisierung
oliverklee
0
10
Gewaltfreie Kommunikation: ein Crashkurs
oliverklee
0
39
Motivationspsychologie und Gamification in Non-Profit-Organisationen
oliverklee
0
81
Test-driven development with PHPUnit
oliverklee
0
150
Writing PHPUnit tests for TYPO3 extensions
oliverklee
0
140
Software quality for TYPO3 projects: A story of cheese, games and tools
oliverklee
0
200
TDD für Senior-Devs
oliverklee
0
61
Gamification für Arbeit in Communities
oliverklee
0
110
Software quality, cheese and games
oliverklee
0
290
Other Decks in Technology
See All in Technology
LLMプロダクト事業の立ち上げにおける挑戦
layerx
PRO
7
1.4k
XRミーティング 2024-03-20
1ftseabass
PRO
0
100
TypeScript Quiz (Encraft #12 Frontend Quiz Night)
uhyo
6
600
Challenges - Open Farming Hackdays 2024
loleg
0
560
どう買う?Azure
kuniteru
1
190
技育祭2024春 LT Finatextホールディングス
kevinrobot34
1
170
任意コード実行の原理
ffri
0
180
HoneycombとOpenTelemetryでオブザーバビリティに入門してみる
sumiren
2
160
依存ライブラリはどこに?
takesection
0
110
戦略的DDDを実践するための跳躍力 / OOC 2024
pictiny
6
4.1k
私のRSpecの書き方 / How I write RSpec
tmtms
4
830
検証からプロダクトへ: シームレスなLLM開発の ためのしくみ作り
nunukim
1
190
Featured
See All Featured
GraphQLとの向き合い方2022年版
quramy
28
12k
WebSockets: Embracing the real-time Web
robhawkes
59
6.9k
The Cult of Friendly URLs
andyhume
73
5.6k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
657
120k
Done Done
chrislema
178
15k
jQuery: Nuts, Bolts and Bling
dougneiner
57
7.1k
Producing Creativity
orderedlist
PRO
335
39k
5 minutes of I Can Smell Your CMS
philhawksworth
199
19k
Making Projects Easy
brettharned
106
5.4k
Making the Leap to Tech Lead
cromwellryan
123
8.4k
No one is an island. Learnings from fostering a developers community.
thoeni
14
2k
Scaling GitHub
holman
456
140k
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