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
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
いかに伝えるか 〜新卒エンジニアの教育のための、ライトノベル活用の一例
ikedon
1
140
指示待ちから変化に応じるClaude Codeへ!~環境からAgentへの帰り道を作る~
gotalab555
9
1.7k
VPCでもFloatingIPを使いたいんだ
y_kotani
1
140
AIレビュー時代に必要なのは、SLOで引く撤退ライン
nobuoooo
0
160
Hub & Spoke 環境のネットワークルーティングを分解してみる
tsuyataku
1
490
PM領域でのAI Agentの活用
lycorptech_jp
PRO
0
200
The Django UUID Story - DjangoCon US 2026
pauloxnet
0
360
[2026-08-25]AIによる自動化と人の介入、その狭間で揺れる信頼性についての俺の思いを、波よ聞いてくれ
tosite
0
120
Master Dataグループ紹介資料
sansan33
PRO
1
4.9k
Point Cloud as a Foreign Language for Multi-modal Large Language Model
takmin
0
350
Kiro5兄弟のいまどきのセキュリティ基礎知識
kentapapa
0
470
AI時代のデータ基盤を考える問い
pacocat
0
800
Featured
See All Featured
ラッコキーワード サービス紹介資料
rakko
1
4.6M
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
630
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
220
Are puppies a ranking factor?
jonoalderson
2
3.9k
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
700
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
590
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
320
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.5k
The Limits of Empathy - UXLibs8
cassininazir
1
620
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
74
42k
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.9k
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