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
パネルディスカッション資料 (at Tableau Now! - 2026-02-26)
yoshitakaarakawa
0
180
Snowflakeデータ基盤で挑むAI活用 〜4年間のDataOpsの基礎をもとに〜
kaz3284
1
180
GoとWasmでつくる軽量ブラウザUI
keyl0ve
0
130
LINEアプリ開発のための Claude Code活用基盤の構築
lycorptech_jp
PRO
1
970
ローカルでLLMを使ってみよう
kosmosebi
0
190
器用貧乏が強みになるまで ~「なんでもやる」が導いたエンジニアとしての現在地~
kakehashi
PRO
5
550
Claude Codeと駆け抜ける 情報収集と実践録
sontixyou
1
1k
Exadata Fleet Update
oracle4engineer
PRO
0
1.2k
使って学ぼう MCP (と GitHub Codespaces)
tsubakimoto_s
1
220
AIで 浮いた時間で 何をする? 2026春 #devsumi
konifar
16
3.3k
Claude Codeはレガシー移行でどこまで使えるのか?
ak2ie
0
910
バイブコーディングで作ったものを紹介
tatsuya1970
0
180
Featured
See All Featured
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
400
Visualization
eitanlees
150
17k
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
130
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.3k
Evolving SEO for Evolving Search Engines
ryanjones
0
140
Everyday Curiosity
cassininazir
0
140
Optimizing for Happiness
mojombo
379
71k
Technical Leadership for Architectural Decision Making
baasie
2
270
Become a Pro
speakerdeck
PRO
31
5.8k
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
67
37k
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.2k
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
370
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