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
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時代のガードレールとしてのAPIガバナンス
nagix
0
300
ServiceNow Knowledge 26 の歩き方
manarobot
0
120
Pure Intonation on Browser: Building a Sequencer with Ruby
nagachika
0
140
はじめての MagicPod生成AI機能 機能紹介から活用方法まで
magicpod
0
110
スクラムの中で AI-DLC workflow を 使い始めて3ヶ月の振り返り
kaminashi
0
100
The Journey of Box Building
tagomoris
4
3.2k
AIが書いたコードを信じられない問題 〜レビュー負荷を下げるために変えたこと〜 / The AI Code Trust Gap: Reducing the Review Burden
bitkey
PRO
8
1.3k
AI時代における技術的負債への取り組み
codenote
1
1.6k
UIライブラリに依存しすぎないReact Native設計を目指して
grandbig
0
100
明日からドヤれる!超マニアックなAWSセキュリティTips10連発 / 10 Ultra-Niche AWS Security Tips
yuj1osm
0
610
Choose your own adventure in agentic design patterns
glaforge
0
140
弁護士ドットコム株式会社 エンジニア職向け 会社紹介資料
bengo4com
1
160
Featured
See All Featured
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.1k
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
450
Practical Orchestrator
shlominoach
191
11k
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
94
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
170
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.4k
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
62
53k
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
310
Information Architects: The Missing Link in Design Systems
soysaucechin
0
890
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
1
530
Raft: Consensus for Rubyists
vanstee
141
7.4k
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