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
大規模ECサイトのあるバッチのパフォーマンスを改善するために僕たちのチームがしてきたこと
panda_program
1
200
Bill One 開発エンジニア 紹介資料
sansan33
PRO
5
18k
【Λ(らむだ)】最近のアプデ情報 / RPALT20260318
lambda
0
120
The_Evolution_of_Bits_AI_SRE.pdf
nulabinc
PRO
0
250
僕、S3 シンプルって名前だけど全然シンプルじゃありません よろしくお願いします
yama3133
1
230
アーキテクチャモダナイゼーションを実現する組織
satohjohn
1
1.1k
OSC仙台プレ勉強会 AlmaLinuxとは
koedoyoshida
0
190
Tebiki Engineering Team Deck
tebiki
0
27k
Claude Code 2026年 最新アップデート
oikon48
14
11k
Go 1.26 Genericsにおける再帰的型制約 / Recursive Type Constraints in Go 1.26 Generics
ryokotmng
0
140
ソフトバンク流!プラットフォームエンジニアリング実現へのアプローチ
sbtechnight
1
220
プラットフォームエンジニアリングはAI時代の開発者をどう救うのか
jacopen
7
3.9k
Featured
See All Featured
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
180
Raft: Consensus for Rubyists
vanstee
141
7.4k
The World Runs on Bad Software
bkeepers
PRO
72
12k
The Curse of the Amulet
leimatthew05
1
10k
How to make the Groovebox
asonas
2
2k
Agile that works and the tools we love
rasmusluckow
331
21k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
150
sira's awesome portfolio website redesign presentation
elsirapls
0
190
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
340
Become a Pro
speakerdeck
PRO
31
5.9k
Product Roadmaps are Hard
iamctodd
PRO
55
12k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
231
22k
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