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
Clean and Quality Unit Tests
Search
codecleaner
November 23, 2013
Technology
570
3
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Clean and Quality Unit Tests
Talk about readability and high quality of unit tests written in PHPUnit
codecleaner
November 23, 2013
Other Decks in Technology
See All in Technology
AI時代のAPI開発を加速する品質ガードレール / API Quality Guardrails in the AI Era
yokawasa
0
180
使いこなすために知っておきたい Azure SRE Agent アンチパターン
torumakabe
2
470
UniFi(ユニファイ)AIカメラの現場活用
ludicmind
1
410
継続的なAIコスト最適化
bgpat
1
280
味覇で作るパスタが美味い - 20261001_yabaubuki.dev
livesense
PRO
0
120
"優秀な誰か"の下位互換にならないために
yut0naga1_fa
1
1.7k
実体験から学ぶ分析エージェントの開発と運⽤
recruitengineers
PRO
8
2k
AI 時代の Azure エンジニアリング ~ 私たちは何を磨き、何を任せるのか ~
chack411
1
580
SREでアラート疲れを 解決しよう!
kairim0
1
220
メルペイ 会計システム概要と歴史
mewuto
0
210
LLM機能を自作して分かるSnowflake Cortex AIの強み
nayuts
0
350
IoTデバイスを繋げるプロトコルMatterをAndroidで使用する方法
harutiro
0
140
Featured
See All Featured
brightonSEO & MeasureFest 2025 - Winning Strategies for Black Friday CRO & PPC - Christian Goodrich
cargoodrich
3
860
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
260
We Have a Design System, Now What?
morganepeng
55
8.4k
Tell your own story through comics
letsgokoyo
1
1.1k
The Invisible Side of Design
smashingmag
301
52k
SEO for Brand Visibility & Recognition
aleyda
0
4.8k
Mind Mapping
helmedeiros
1
400
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
400
The Art of Programming - Codeland 2020
erikaheidi
57
14k
Designing Experiences People Love
moore
143
24k
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
590
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
400
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