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
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
codecleaner
November 23, 2013
Technology
560
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
DatadogのBits Chatが開発組織にもたらしたもの / What Bits Chat Has Brought Us
sms_tech
1
190
20260608_Codexの可能性_ノンプログラマー向け_大城追記
doradora09
PRO
0
790
PLATEAU で バーチャル花火大会
tatsuya1970
0
140
ガバメントクラウドでのランサムウェア対策
techniczna
2
1.1k
Invisible to AI? Making TYPO3 Sites Quotable by AI Search Systems
wolfgangwagner
0
190
Flutterをカメラで動かしたかった話
sony
1
130
ガバメント AI 源内を地方自治体は活用できるのか可能性と課題、期待について
takeda_h
1
390
ホームラボ紹介
y_sera15
0
150
AIコーディングの次。コードレビューと理解負荷を解消して組織の開発生産性を高める
moongift
PRO
2
2.4k
修正PRを食べてレビュースキルが賢くなる:Claude Codeによる自己改善サイクル
yuyaumetsu
6
1.4k
Goでデータパイプラインを作ろう
sansantech
PRO
1
410
JavaScript 研修 (2026)
recruitengineers
PRO
2
500
Featured
See All Featured
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
630
Exploring anti-patterns in Rails
aemeredith
3
460
Raft: Consensus for Rubyists
vanstee
141
7.6k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.7k
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
630
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
520
Paper Plane (Part 1)
katiecoart
PRO
1
10k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.8k
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.4k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
3k
Optimising Largest Contentful Paint
csswizardry
37
3.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