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
Clean and Quality Unit Tests
Search
codecleaner
November 23, 2013
Technology
3
540
Clean and Quality Unit Tests
Talk about readability and high quality of unit tests written in PHPUnit
codecleaner
November 23, 2013
Tweet
Share
Other Decks in Technology
See All in Technology
製造業向けIoTソリューション提案資料.pdf
haruki_uiru
0
230
Aspire をカスタマイズしよう & Aspire 9.2
nenonaninu
0
380
エンジニアリングで組織のアウトカムを最速で最大化する!
ham0215
1
300
C++26アップデート 2025-03
faithandbrave
0
1.2k
TanStack Start 技術選定の裏側 / Findy-Lunch-LT-TanStack-Start
iktakahiro
0
100
クラウドネイティブ環境の脅威モデリング
kyohmizu
1
400
AIと共同執筆してより質の高い記事を書こう
riyaamemiya
1
210
雑に疎通確認だけしたい...せや!CloudShell使ったろ!
alchemy1115
0
210
Notion x ポストモーテムで広げる組織の学び / Notion x Postmortem
isaoshimizu
1
160
Previewでもここまで追える! Azure AI Foundryで始めるLLMトレース
tomodo_ysys
2
610
AndroidアプリエンジニアもMCPを触ろう
kgmyshin
2
640
AI駆動で進化する開発プロセス ~クラスメソッドでの実践と成功事例~ / aidd-in-classmethod
tomoki10
1
1k
Featured
See All Featured
Building Applications with DynamoDB
mza
94
6.4k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
45
7.2k
Into the Great Unknown - MozCon
thekraken
38
1.8k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
160
15k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.3k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
29
1.7k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
120
52k
Why Our Code Smells
bkeepers
PRO
336
57k
Documentation Writing (for coders)
carmenintech
71
4.8k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
10
780
Side Projects
sachag
453
42k
Art, The Web, and Tiny UX
lynnandtonic
298
20k
Transcript
Clean & Quality unit tests
Wojtek Zieliński @codecleaner
• Names matters • Exceptions • Test Doubles • Stubbing
Collections • Arrange Act Assert What’s it all about?
Names matters
None
None
None
None
None
None
None
None
Test a single concept in each test function Robert C.
Martin
None
None
None
None
None
None
None
None
None
None
Exceptions
None
None
None
None
None
None
None
None
None
None
None
None
Test Doubles
None
None
None
How does getMock() really work? • Does Configuration class exist?
• Create Mock_Configuration_123abc class extends Configuration class • Create instance of that class • Return instance
How does getMock() really work? • Does Configuration class exist?
• Create Mock_Configuration_123abc class extends Configuration class • Create instance of that class • Return instance • Create Configuration class
None
None
None
None
None
None
None
None
None
None
None
None
Stubs provide canned answers to calls made during the test
"Mocks Aren’t Stubs" Martin Fowler
Mocks are objects pre-programmed with expectations which form a specification
of the calls they are expected to receive "Mocks Aren’t Stubs" Martin Fowler
None
None
None
None
None
None
None
None
None
None
None
None
Stubbing collections
None
None
Arrange Act Assert
None
None
None
It’s all about readability
None
None
What’s next?
None
None
Questions? Wojtek Zieliński @codecleaner