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
Testing value objects
Search
Fran Iglesias
November 02, 2018
Programming
0
190
Testing value objects
How to test things like immutability
Fran Iglesias
November 02, 2018
Tweet
Share
More Decks by Fran Iglesias
See All by Fran Iglesias
Tips for daily refactoring
franiglesias
0
310
Introduction to TDD: Red-Green-Refactor
franiglesias
1
200
testing the unpredictable
franiglesias
0
160
Tests doubles: the motion picture
franiglesias
0
400
Low cost techniques for test doubles
franiglesias
0
140
Other Decks in Programming
See All in Programming
PSR-15 はあなたのための ものではない? - phpcon2024
myamagishi
0
110
KubeCon + CloudNativeCon NA 2024 Overviewat Kubernetes Meetup Tokyo #68 / amsy810_k8sjp68
masayaaoyama
0
250
テストケースの名前はどうつけるべきか?
orgachem
PRO
0
130
情報漏洩させないための設計
kubotak
0
120
fs2-io を試してたらバグを見つけて直した話
chencmd
0
230
103 Early Hints
sugi_0000
1
230
Итераторы в Go 1.23: зачем они нужны, как использовать, и насколько они быстрые?
lamodatech
0
750
php-conference-japan-2024
tasuku43
0
270
17年周年のWebアプリケーションにTanStack Queryを導入する / Implementing TanStack Query in a 17th Anniversary Web Application
saitolume
0
250
The Efficiency Paradox and How to Save Yourself and the World
hollycummins
1
440
【re:Growth 2024】 Aurora DSQL をちゃんと話します!
maroon1st
0
770
Effective Signals in Angular 19+: Rules and Helpers @ngbe2024
manfredsteyer
PRO
0
130
Featured
See All Featured
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.3k
Being A Developer After 40
akosma
87
590k
Building Your Own Lightsaber
phodgson
103
6.1k
Testing 201, or: Great Expectations
jmmastey
40
7.1k
Typedesign – Prime Four
hannesfritz
40
2.4k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
95
17k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
28
4.4k
Art, The Web, and Tiny UX
lynnandtonic
298
20k
Done Done
chrislema
181
16k
Rails Girls Zürich Keynote
gr2m
94
13k
Statistics for Hackers
jakevdp
796
220k
Faster Mobile Websites
deanohume
305
30k
Transcript
TDD 101 2. TDDing Value Objects
TDDing Value Objects
Value Object (DDD) Small object Represents a concept Equality based
on value Immutable: • Should be created consistent • Mutators should return new instances
So… How do you TDD a VO?
TDD VO Think of an invalid example Write a test
that fails expecting exception Make the test pass Repeat as needed to test invalid cases
TDD VO Think of a valid example Write a test
that fails asserting value Make the test pass
TDD VO Equality Write a test that fails expecting inequality
Make the test pass Then write a test that fails expecting equality Make the test pass
TDD VO Immutability Think of a valid example of a
mutator Write a test that fails expecting a different instance Make the test pass
None