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
11
Vertrauen in Teams & Führung
oliverklee
0
70
Software-Qualität von TYPO3-Extensions automatisieren
oliverklee
0
6
Vertrauen in Teams & Führung
oliverklee
0
73
Testing von TYPO3-Extensions
oliverklee
0
13
Software-Qualität von Extensions automatisieren
oliverklee
1
9
Content-Synchronisierung
oliverklee
0
76
Gewaltfreie Kommunikation: ein Crashkurs
oliverklee
0
190
Motivationspsychologie und Gamification in Non-Profit-Organisationen
oliverklee
0
110
Other Decks in Technology
See All in Technology
[CV勉強会@関東 ECCV2024 読み会] オンラインマッピング x トラッキング MapTracker: Tracking with Strided Memory Fusion for Consistent Vector HD Mapping (Chen+, ECCV24)
abemii
0
220
dev 補講: プロダクトセキュリティ / Product security overview
wa6sn
1
2.3k
10XにおけるData Contractの導入について: Data Contract事例共有会
10xinc
5
540
AIチャットボット開発への生成AI活用
ryomrt
0
170
マルチモーダル / AI Agent / LLMOps 3つの技術トレンドで理解するLLMの今後の展望
hirosatogamo
37
12k
Lexical Analysis
shigashiyama
1
150
BLADE: An Attempt to Automate Penetration Testing Using Autonomous AI Agents
bbrbbq
0
290
Lambda10周年!Lambdaは何をもたらしたか
smt7174
2
110
AWS Lambda のトラブルシュートをしていて思うこと
kazzpapa3
2
170
[FOSS4G 2024 Japan LT] LLMを使ってGISデータ解析を自動化したい!
nssv
1
210
開発生産性を上げながらビジネスも30倍成長させてきたチームの姿
kamina_zzz
2
1.6k
Taming you application's environments
salaboy
0
180
Featured
See All Featured
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
42
9.2k
4 Signs Your Business is Dying
shpigford
180
21k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5k
Designing for humans not robots
tammielis
250
25k
Statistics for Hackers
jakevdp
796
220k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
KATA
mclloyd
29
14k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
4
370
RailsConf 2023
tenderlove
29
900
Testing 201, or: Great Expectations
jmmastey
38
7.1k
Git: the NoSQL Database
bkeepers
PRO
427
64k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
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