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
.NET 最新アップデート ~ AI とクラウド時代のアプリモダナイゼーション
chack411
0
200
JuliaTokaiとJuliaLangJaの紹介 for NGK2025S
antimon2
1
130
Visual StudioとかIDE関連小ネタ話
kosmosebi
1
380
駆け出しリーダーとしての第一歩〜開発チームとの新しい関わり方〜 / Beginning Journey as Team Leader
kaonavi
0
130
「人物ごとのアルバム」の精度改善の軌跡/Improving accuracy of albums by person
mixi_engineers
PRO
1
120
2025年の挑戦 コーポレートエンジニアの技術広報/techpr5
nishiuma
0
150
Oracle Base Database Service 技術詳細
oracle4engineer
PRO
6
55k
2024年活動報告会(人材育成推進WG・ビジネスサブWG) / 20250114-OIDF-J-EduWG-BizSWG
oidfj
0
240
WantedlyでのKotlin Multiplatformの導入と課題 / Kotlin Multiplatform Implementation and Challenges at Wantedly
kubode
0
250
[IBM TechXchange Dojo]Watson Discoveryとwatsonx.aiでRAGを実現!座学①
siyuanzh09
0
110
いま現場PMのあなたが、 経営と向き合うPMになるために 必要なこと、腹をくくること
hiro93n
9
7.8k
デジタルアイデンティティ人材育成推進ワーキンググループ 翻訳サブワーキンググループ 活動報告 / 20250114-OIDF-J-EduWG-TranslationSWG
oidfj
0
550
Featured
See All Featured
GraphQLとの向き合い方2022年版
quramy
44
13k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5.1k
jQuery: Nuts, Bolts and Bling
dougneiner
62
7.6k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
98
18k
Imperfection Machines: The Place of Print at Facebook
scottboms
267
13k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
3.6k
Rails Girls Zürich Keynote
gr2m
94
13k
What's in a price? How to price your products and services
michaelherold
244
12k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
The World Runs on Bad Software
bkeepers
PRO
66
11k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
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