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
550
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
Java 25に至る道
skrb
3
210
戰略轉變:從建構 AI 代理人到發展可擴展的技能生態系統
appleboy
0
190
Scrum Guide Expansion Pack が示す現代プロダクト開発への補完的視点
sonjin
0
620
Oracle Database@AWS:サービス概要のご紹介
oracle4engineer
PRO
2
870
ファインディにおけるフロントエンド技術選定の歴史
puku0x
2
1.5k
[PR] はじめてのデジタルアイデンティティという本を書きました
ritou
1
800
産業的変化も組織的変化も乗り越えられるチームへの成長 〜チームの変化から見出す明るい未来〜
kakehashi
PRO
1
570
業務の煩悩を祓うAI活用術108選 / AI 108 Usages
smartbank
9
21k
国井さんにPurview の話を聞く会
sophiakunii
1
370
ECS_EKS以外の選択肢_ROSA入門_.pdf
masakiokuda
1
130
投資戦略を量産せよ 2 - マケデコセミナー(2025/12/26)
gamella
1
640
人工知能のための哲学塾 ニューロフィロソフィ篇 第零夜 「ニューロフィロソフィとは何か?」
miyayou
0
440
Featured
See All Featured
The browser strikes back
jonoalderson
0
300
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
39
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
46
The Limits of Empathy - UXLibs8
cassininazir
1
200
Un-Boring Meetings
codingconduct
0
180
Building the Perfect Custom Keyboard
takai
2
670
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
240
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Designing for Timeless Needs
cassininazir
0
110
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
196
71k
Technical Leadership for Architectural Decision Making
baasie
0
200
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