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 Tests
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Noam Almog
February 24, 2017
Programming
0
75
Clean Tests
Clean test presentation,
Kiev JUG, 23.2.17
Noam Almog
February 24, 2017
Tweet
Share
More Decks by Noam Almog
See All by Noam Almog
Rapid Development with Microservices
noamal
0
440
Clean Tests - Scala UA
noamal
0
110
Other Decks in Programming
See All in Programming
ThorVG Viewer In VS Code
nors
0
750
QAフローを最適化し、品質水準を満たしながらリリースまでの期間を最短化する #RSGT2026
shibayu36
2
3.9k
Honoを使ったリモートMCPサーバでAIツールとの連携を加速させる!
tosuri13
1
160
AIで開発はどれくらい加速したのか?AIエージェントによるコード生成を、現場の評価と研究開発の評価の両面からdeep diveしてみる
daisuketakeda
1
890
Pythonではじめるオープンデータ分析〜書籍の紹介と書籍で紹介しきれなかった事例の紹介〜
welliving
3
840
AgentCoreとHuman in the Loop
har1101
5
200
AtCoder Conference 2025「LLM時代のAHC」
imjk
2
710
フルサイクルエンジニアリングをAI Agentで全自動化したい 〜構想と現在地〜
kamina_zzz
0
380
組織で育むオブザーバビリティ
ryota_hnk
0
140
クラウドに依存しないS3を使った開発術
simesaba80
0
230
Findy AI+の開発、運用におけるMCP活用事例
starfish719
0
2.3k
Spinner 軸ズレ現象を調べたらレンダリング深淵に飲まれた #レバテックMeetup
bengo4com
1
220
Featured
See All Featured
Ruling the World: When Life Gets Gamed
codingconduct
0
130
Reality Check: Gamification 10 Years Later
codingconduct
0
2k
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
57
Become a Pro
speakerdeck
PRO
31
5.8k
YesSQL, Process and Tooling at Scale
rocio
174
15k
Mobile First: as difficult as doing things right
swwweet
225
10k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
45
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
110
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
46
For a Future-Friendly Web
brad_frost
181
10k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
410
Transcript
Clean Tests Noam Almog | Tech Lead linkedin github.com/noam-almog @NoamSon
[email protected]
Hi. Tech Lead Wix.com Noam Almog
AGENDA Intro Review Test Structures Refactor each part of the
test Conclude
Should I Clean ? § Test lasts More than production
Code. § More Lines of code § Read and reviewed More
If you let the tests rot, then your code will
rot too “ “ Robert C. Martin
What Is ”Good” ? § How easy is it to
extend it ? § When break, is it easy to fix ? § How many “Rewrite” calls ?
Test Structure 01
Test Structure § Test is a Map to your code.
§ Reveille the right amount of details. § Should be Consistent (*)
Test Structure
From Testing Code to Testing Behavior
Structure Pitfalls Test only one thing
Structure Pitfalls Hide Too Much Data
Send Mail invoke
New Test 01
Test Description § Use Plain English § Use Simple Language
– Not Code ! § Find a sentence structure § “throw an exception if user does not exist” § “send an email to the the email registered with the site-id”
Test Description Does not Compile
Test Setup 02
Can A Single Test Case Stand on His own
Extract Setup to Methods § Select method name that implies
structure § Starts with given § Contain the collaborator name § Describe the defined Behavior § Reverse the order of parameters § Use parameter names to show what is important
Describe the What are testing, NOT How you are testing
Simplify The Code § Do not use concrete values in
the test. § Reduce number of moving parts § Do not move important logic out of the scope
Extract Drivers § Move all setup method to it §
Move all related variables to it § Split according to the Subject
When is a good time to start ? Now !
Test Action 03
Test Action § Should be a single statement § Do
NOT hide !
Test Expectations 04
Matchers, Why ? § Readable § Better Failure Messages §
Reusable and Flexible
Matcher libraries § Hamcrest (Java) § Chai (JS) § Specs2/ScalaTest
(Scala)
Match Expectations § Use just one matcher § Describe what
you are matching, now how § Don’t define any new variables
Use Only what You Defined
Failure Messages Can you tell me why this failed ?
Conclusion § Test behavior and not code § Test Should
stand on his own § Describe what and not how § Start today, don’t wait for tomorrow § Use only variables you defined
Thank You linkedin github.com/noam-almog @NoamSon
[email protected]
Q&A linkedin github.com/noam-almog @NoamSon
[email protected]