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
【NGK2025S】動物園(PINTO_model_zoo)に遊びに行こう
kazuhitotakahashi
0
250
東京Ruby会議12 Ruby と Rust と私 / Tokyo RubyKaigi 12 Ruby, Rust and me
eagletmt
3
880
Reactフレームワークプロダクトを モバイルアプリにして、もっと便利に。 ユーザに価値を届けよう。/React Framework with Capacitor
rdlabo
0
130
Cloudflareで実現する AIエージェント ワークフロー基盤
kmd09
0
290
Oracle Exadata Database Service(Dedicated Infrastructure):サービス概要のご紹介
oracle4engineer
PRO
0
12k
AIアプリケーション開発でAzure AI Searchを使いこなすためには
isidaitc
1
120
テストを書かないためのテスト/ Tests for not writing tests
sinsoku
1
170
ゼロからわかる!!AWSの構成図を書いてみようワークショップ 問題&解答解説 #デッカイギ #羽田デッカイギおつ
_mossann_t
0
1.5k
30分でわかる「リスクから学ぶKubernetesコンテナセキュリティ」/30min-k8s-container-sec
mochizuki875
3
450
2025年のARグラスの潮流
kotauchisunsun
0
800
三菱電機で社内コミュニティを立ち上げた話
kurebayashi
1
360
CDKのコードレビューを楽にするパッケージcdk-mentorを作ってみた/cdk-mentor
tomoki10
0
210
Featured
See All Featured
GitHub's CSS Performance
jonrohan
1030
460k
The Cult of Friendly URLs
andyhume
78
6.1k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
49k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
113
50k
Typedesign – Prime Four
hannesfritz
40
2.5k
4 Signs Your Business is Dying
shpigford
182
22k
The Invisible Side of Design
smashingmag
299
50k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
10
870
How GitHub (no longer) Works
holman
312
140k
Site-Speed That Sticks
csswizardry
3
270
Side Projects
sachag
452
42k
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