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
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
AI時代のIssue駆動開発のススメ
moongift
PRO
0
360
互換性のある(らしい)DBへの移行など考えるにあたってたいへんざっくり
sejima
PRO
0
540
Datadog で実現するセキュリティ対策 ~オブザーバビリティとセキュリティを 一緒にやると何がいいのか~
a2ush
0
190
OPENLOGI Company Profile for engineer
hr01
1
62k
OCI技術資料 : ロード・バランサ 概要 - FLB・NLB共通
ocise
4
27k
推し活エージェント
yuntan_t
1
720
Zephyr(RTOS)でARMとRISC-Vのコア間通信をしてみた
iotengineer22
0
120
40代からのアウトプット ― 経験は価値ある学びに変わる / 20260404 Naoki Takahashi
shift_evolve
PRO
5
800
Goビルドを理解し、 CI/CDの高速化に挑む
satoshin
0
110
Oracle AI Database@AWS:サービス概要のご紹介
oracle4engineer
PRO
3
2.1k
JSTQB Expert Levelシラバス「テストマネジメント」日本語版のご紹介
ymty
0
120
遊びで始めたNew Relic MCP、気づいたらChatOpsなオブザーバビリティボットができてました/From New Relic MCP to a ChatOps Observability Bot
aeonpeople
1
160
Featured
See All Featured
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
0
960
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
220
How GitHub (no longer) Works
holman
316
150k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
480
エンジニアに許された特別な時間の終わり
watany
106
240k
We Are The Robots
honzajavorek
0
210
How STYLIGHT went responsive
nonsquared
100
6k
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
110
A Tale of Four Properties
chriscoyier
163
24k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.2k
Exploring anti-patterns in Rails
aemeredith
3
300
Git: the NoSQL Database
bkeepers
PRO
432
67k
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