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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
codecleaner
November 23, 2013
Technology
560
3
Share
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
みんなの「データ活用」を支えるストレージ担当から持ち込むAWS活用/コミュニティー設計TIPS 10選~「作れる」より、「続けられる」設計へ~
yoshiki0705
0
210
All About Sansan – for New Global Engineers
sansan33
PRO
1
1.4k
NOSTR, réseau social et espace de liberté décentralisé
rlifchitz
0
200
扱える不確実性を増やしていく - スタートアップEMが考える「任せ方」
kadoppe
0
250
ARIA Notifyについて
ryokatsuse
1
110
20260415_生成AIを専属DSに_自動レポート作成_ハンズオン_交通事故データ
doradora09
PRO
0
110
「責任あるAIエージェント」こそ自社で開発しよう!
minorun365
9
1.6k
JEDAI in Osaka 2026イントロ
taka_aki
0
240
AIエージェントを構築して感じた、AI時代のCDKとの向き合い方
smt7174
1
250
Revisiting [CLS] and Patch Token Interaction in Vision Transformers
yu4u
0
310
DevOpsDays Tokyo 2026 軽量な仕様書と新たなDORA AI ケイパビリティで実現する、動くソフトウェアを中心とした開発ライフサイクル / DevOpsDays Tokyo 2026
n11sh1
0
150
最近の技術系の話題で気になったもの色々(IoT系以外も) / IoTLT 花見予定会(たぶんBBQ) @都立潮風公園バーベキュー広場
you
PRO
1
210
Featured
See All Featured
RailsConf 2023
tenderlove
30
1.4k
The Spectacular Lies of Maps
axbom
PRO
1
690
Building Adaptive Systems
keathley
44
3k
Test your architecture with Archunit
thirion
1
2.2k
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.3k
The SEO Collaboration Effect
kristinabergwall1
0
420
The Cult of Friendly URLs
andyhume
79
6.8k
We Have a Design System, Now What?
morganepeng
55
8.1k
The browser strikes back
jonoalderson
0
960
What does AI have to do with Human Rights?
axbom
PRO
1
2.1k
Making Projects Easy
brettharned
120
6.6k
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