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
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
水を運ぶ人としてのリーダーシップ
izumii19
4
1k
脱SaaS!FDEを支えるプロビジョニングと分離設計
knih
0
300
AI 不只幫你寫 Code: 當專案從 300 暴增到 1500, 我們如何撐住 DevOps
appleboy
0
260
AIに障害切り分けを全部やってもらった。 。 。 。
estie
0
200
4人目のSREはAgent
tanimuyk
0
220
フルAIで個人開発して学んだあれこれ / yuruai vol.1
isaoshimizu
0
130
5分でわかる Amazon Connect_20260608
hwangbyeonghun
0
120
【Snowflake Summit 2026 Recap!!】Snowflake Summit Deep Dive: Security & Governance
civitaspo
1
320
データレイクの「見えない問題」を可視化する
sansantech
PRO
1
210
週末にループ・エンジニアリングの理解を深めるためのスライド
nagatsu
0
480
ご挨拶「10周年を迎える共創ラボのこれまでとこれから」
iotcomjpadmin
0
140
「勝手に広まる」人気 AI エージェントを爆速で作ろう!(AWS Summit Japan 2026講演資料)
minorun365
PRO
10
2.6k
Featured
See All Featured
The Art of Programming - Codeland 2020
erikaheidi
57
14k
Java REST API Framework Comparison - PWX 2021
mraible
34
9.4k
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
1.1k
The agentic SEO stack - context over prompts
schlessera
0
820
Documentation Writing (for coders)
carmenintech
77
5.4k
Crafting Experiences
bethany
1
190
Optimizing for Happiness
mojombo
378
71k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
220
ラッコキーワード サービス紹介資料
rakko
1
3.7M
Un-Boring Meetings
codingconduct
0
320
Why Our Code Smells
bkeepers
PRO
340
58k
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