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
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
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
VPCエンドポイント意外とお金かかるなぁ。せや、共有したろ!
tommy0124
0
510
OCI Security サービス 概要
oracle4engineer
PRO
2
13k
作りっぱなしで終わらせない! 価値を出し続ける AI エージェントのための「信頼性」設計 / Designing Reliability for AI Agents that Deliver Continuous Value
aoto
PRO
2
290
OSC仙台プレ勉強会 AlmaLinuxとは
koedoyoshida
0
160
Yahoo!ショッピングのレコメンデーション・システムにおけるML実践の一例
lycorptech_jp
PRO
1
210
Exadata Database Service on Dedicated Infrastructure(ExaDB-D) UI スクリーン・キャプチャ集
oracle4engineer
PRO
8
7.2k
実践 Datadog MCP Server
nulabinc
PRO
2
190
会社紹介資料 / Sansan Company Profile
sansan33
PRO
16
410k
社内レビューは機能しているのか
matsuba
0
120
us-east-1 に障害が起きた時に、 ap-northeast-1 にどんな影響があるか 説明できるようになろう!
miu_crescent
PRO
13
4.3k
Sansanでの認証基盤内製化と移行
sansantech
PRO
0
350
AI時代のSaaSとETL
shoe116
1
140
Featured
See All Featured
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.3k
Agile that works and the tools we love
rasmusluckow
331
21k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
2
990
Are puppies a ranking factor?
jonoalderson
1
3.1k
Optimising Largest Contentful Paint
csswizardry
37
3.6k
Accessibility Awareness
sabderemane
0
80
The SEO Collaboration Effect
kristinabergwall1
0
390
The World Runs on Bad Software
bkeepers
PRO
72
12k
jQuery: Nuts, Bolts and Bling
dougneiner
65
8.4k
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
340
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
30k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
190
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