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
ハッカソンから社内プロダクトへ AIエージェント ko☆shi 開発で学んだ4つの重要要素
leveragestech
0
540
わが10年の叡智をぶつけたカオスなクラウドインフラが、なくなるということ。
sogaoh
PRO
1
190
AI with TiDD
shiraji
1
330
AWS re:Inventre:cap ~AmazonNova 2 Omniのワークショップを体験してきた~
nrinetcom
PRO
0
130
Contract One Engineering Unit 紹介資料
sansan33
PRO
0
12k
投資戦略を量産せよ 2 - マケデコセミナー(2025/12/26)
gamella
1
600
CQRS/ESになぜアクターモデルが必要なのか
j5ik2o
0
370
20251225_たのしい出張報告&IgniteRecap!
ponponmikankan
0
110
Cloud WAN MCP Serverから考える新しいネットワーク運用 / 20251228 Masaki Okuda
shift_evolve
PRO
0
130
Introduction to Sansan, inc / Sansan Global Development Center, Inc.
sansan33
PRO
0
2.9k
Eight Engineering Unit 紹介資料
sansan33
PRO
0
6.1k
[PR] はじめてのデジタルアイデンティティという本を書きました
ritou
0
750
Featured
See All Featured
Six Lessons from altMBA
skipperchong
29
4.1k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
1
340
First, design no harm
axbom
PRO
1
1.1k
Done Done
chrislema
186
16k
The World Runs on Bad Software
bkeepers
PRO
72
12k
The browser strikes back
jonoalderson
0
290
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
360
BBQ
matthewcrist
89
9.9k
Darren the Foodie - Storyboard
khoart
PRO
0
2.1k
Building an army of robots
kneath
306
46k
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
27
Mobile First: as difficult as doing things right
swwweet
225
10k
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