How Scala made my
tests more meaningful
by Piotr Gabryanczyk
Slide 2
Slide 2 text
What is a good test?
• easy to write
• easy to read and understand
• easy to evolve with the system
• bang for buck
• meaningful
Slide 3
Slide 3 text
Which tests are
meaningful?
• written using abstractions appropriate for
the component you are testing
• using vocabulary defined by the API of the
component
Slide 4
Slide 4 text
Meaningful test
Slide 5
Slide 5 text
Are integration
tests more
meaningful?
Slide 6
Slide 6 text
No content
Slide 7
Slide 7 text
Why is it hard to write
integration tests?
Slide 8
Slide 8 text
Why is it hard to write
integration tests?
Slide 9
Slide 9 text
Why is it hard to write
integration tests?
Slide 10
Slide 10 text
Why is it hard to write
integration tests?
Slide 11
Slide 11 text
Hexagonal Architecture
Slide 12
Slide 12 text
Adapters raise the level
of abstraction
Slide 13
Slide 13 text
Adapters raise the level
of abstraction
Slide 14
Slide 14 text
Fake for every adapter
Slide 15
Slide 15 text
Mixing fake and real
adapters
Slide 16
Slide 16 text
Writing fakes is easy -
higher order functions
Slide 17
Slide 17 text
Very bad test
data
Slide 18
Slide 18 text
Very bad test
data
Slide 19
Slide 19 text
Builder Pattern
Slide 20
Slide 20 text
Builder Pattern
Slide 21
Slide 21 text
Builder Pattern
Slide 22
Slide 22 text
It is easy if you build it
up gradually
Slide 23
Slide 23 text
It is easy if you build it
up gradually
Slide 24
Slide 24 text
Everything
depends on
everything
Slide 25
Slide 25 text
Peers vs Internals
Wikipedia
DB
Graph
Analyzer
XML
Parser
Slide 26
Slide 26 text
Fewer dependencies
Wikipedia
DB
Graph
Analyzer
XML
Parser
DB
Adapter
Wikipedia
Adapter