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
540
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
QAEチームが辿った3年 ボクらが改善業務にスクラムを選んだワケ / 20241108_cloudsign_ques23
bengo4com
0
580
信頼性に挑む中で拡張できる・得られる1人のスキルセットとは?
ken5scal
1
370
組み込みLinuxの時系列
puhitaku
4
990
マイベストのデータ基盤の現在と未来 / mybest-data-infra-asis-tobe
mybestinc
2
1.9k
ISUCONに強くなるかもしれない日々の過ごしかた/Findy ISUCON 2024-11-14
fujiwara3
3
300
Oracle Cloud Infrastructureデータベース・クラウド:各バージョンのサポート期間
oracle4engineer
PRO
28
12k
ドメイン名の終活について - JPAAWG 7th -
mikit
29
16k
Deno+JSRでパッケージを作って公開する
askua
0
110
第23回Ques_タイミーにおけるQAチームの在り方 / QA Team in Timee
takeyaqa
0
180
DatabricksにおけるLLMOpsのベストプラクティス
taka_aki
4
1.6k
What to do after `laravel new`
mattstauffer
0
140
Postmanの日本市場におけるDevRel (的) 活動 / Postman's DevRelish activities in Japan
yokawasa
1
120
Featured
See All Featured
How to train your dragon (web standard)
notwaldorf
88
5.7k
Building a Scalable Design System with Sketch
lauravandoore
459
33k
A designer walks into a library…
pauljervisheath
202
24k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.1k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.8k
Reflections from 52 weeks, 52 projects
jeffersonlam
346
20k
Gamification - CAS2011
davidbonilla
80
5k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.4k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
27
810
It's Worth the Effort
3n
183
27k
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
505
140k
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