Testing strategies
Software Craft Grenoble 20/09/2022
Test SUT
Stub
Spy
Test SUT Fake /
Simulator
Other
classes
Setup
Setup
Veri
fi
cation
Veri
fi
cation
Testing with mocks
Testing with fakes
Test SUT Fake /
Simulator
Other
classes
Setup
Veri
fi
cation
Domai
n



Interface
Read depencency
Test SUT Fake /
Simulator
Other
classes
Setup
Veri
fi
cation
Domai
n



Interface
Write depencency
Test SUT Fake /
Simulator
Other
classes
Setup
Veri
fi
cation
Read-Write depencency
Syste
m

test
Applicatio
n

test
Uni
t

test
Contract
Contrac
t

test
Test
Real
adapter
Simulator
Contract
 

=
 

running the same test
Domai
n



Interface
Including
 

anti-corruptio
n

layer
External


Service
Values of a test
• Protect against regressions


• Allow refactoring


• Allow changes


• Fast


• Deterministic


• Con
fi
dence


• Precise


• Documentation
Types of external
dependencies
Rea
d

- Registries


- Pdf extraction


- Weather


Writ
e

- Emailing


- Payments


- Job launching
Read - Writ
e

- Data stores


- Identity pools


- File systems
Annoyances with adapter
tests
• Availability


• Speed


• External changes? - and frequency


• Cost of call


• Accessible locally?

Testing strategies