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
280
0
Share
Testing value objects
How to test things like immutability
Fran Iglesias
November 02, 2018
More Decks by Fran Iglesias
See All by Fran Iglesias
Tips for daily refactoring
franiglesias
0
350
Introduction to TDD: Red-Green-Refactor
franiglesias
1
300
testing the unpredictable
franiglesias
0
250
Tests doubles: the motion picture
franiglesias
0
530
Low cost techniques for test doubles
franiglesias
0
230
Other Decks in Programming
See All in Programming
t *testing.T は どこからやってくるの?
otakakot
1
900
書籍「ユーザーストーリーマッピング」が私のバイブル
asumikam
4
480
tRPCの概要と少しだけパフォーマンス
misoton665
2
260
How We Practice Exploratory Testing in Iterative Development( #scrumniigata ) / 反復開発の中で、探索的テストをどう実施しているか
teyamagu
PRO
3
700
2026-04-15 Spring IO - I Can See Clearly Now
jonatan_ivanov
1
180
Lightning-Fast Method Calls with Ruby 4.1 ZJIT / RubyKaigi 2026
k0kubun
3
2.6k
〜バイブコーディングを超えて〜 チームで実験し続けたAI駆動開発
tigertora7571
0
190
PHPでローカル環境用のSSL/TLS証明書を発行することはできるのか? #phpconkagawa
akase244
0
330
PHPer、Cloudflare に引っ越す
suguruooki
1
140
【26新卒研修】OpenAPI/Swagger REST API研修
dip_tech
PRO
0
140
AI-DLC Deep Dive
yuukiyo
9
5.6k
Kingdom of the Machine
yui_knk
2
1.4k
Featured
See All Featured
The browser strikes back
jonoalderson
0
1k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
180
The Cost Of JavaScript in 2023
addyosmani
55
9.9k
Visualization
eitanlees
150
17k
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
160
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Claude Code のすすめ
schroneko
67
220k
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.1k
Bash Introduction
62gerente
615
210k
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.2k
Code Review Best Practice
trishagee
74
20k
Bootstrapping a Software Product
garrettdimon
PRO
307
120k
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