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
OCI で始める!! Red Hat OpenShift / Get Started OpenShift on OCI
oracle4engineer
PRO
1
200
DroidKaigi 2024 たすけて!ViewModel
mhidaka
5
1.1k
AIで変わるテスト自動化:最新ツールの多様なアプローチ/ 20240910 Takahiro Kaneyama
shift_evolve
0
250
「認証認可」という体験をデザインする ~Nekko Cloud認証認可基盤計画
logica0419
2
450
AI前提のサービス運用ってなんだろう?
ryuichi1208
3
1.1k
ロリポップ! for Gamersを支えるインフラ/lolipop for gamers infrastructure
takumakume
0
140
再考 アクターモデル/ reconsider actor model
ytake
0
380
watsonx.ai Dojo 環境準備について
oniak3ibm
PRO
0
360
eBPFのこれまでとこれから
yutarohayakawa
10
3.3k
自作Cコンパイラ 8時間の奮闘
soukouki
0
850
Classmethod AI Talks(CATs) #1 司会進行スライド(2024.09.19) / classmethod-ai-talks-aka-cats_moderator-slides_vol1_2024-09-19
shinyaa31
0
240
サプライチェーン攻撃に備える
ryunen344
0
390
Featured
See All Featured
Rebuilding a faster, lazier Slack
samanthasiow
78
8.6k
Build your cross-platform service in a week with App Engine
jlugia
228
18k
Done Done
chrislema
180
16k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
23
1.7k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
38
9.2k
The Power of CSS Pseudo Elements
geoffreycrofte
71
5.3k
Embracing the Ebb and Flow
colly
83
4.4k
In The Pink: A Labor of Love
frogandcode
139
22k
Building Flexible Design Systems
yeseniaperezcruz
325
38k
A Modern Web Designer's Workflow
chriscoyier
692
190k
Rails Girls Zürich Keynote
gr2m
93
13k
Building Applications with DynamoDB
mza
90
6k
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