Dennis Doomen | @ddoomen | Aviva Solutions | The Continuous Improver
(An opinionated definition)
…is fast
(< 50ms)
…runs
in-memory
…can be run in
any order
…causes no
collateral
damage
…has no static
dependencies
…has no I/O-
bound
dependencies
…can be run in
parallel
UI Automation
HTTP/API Tests
Component /
integration Tests
Unit Tests
(in my definition)
Design class
responsibilities
Write first unit
test
Generate stubs
Fail for the right
reason
Implement
real deal
Ensure test
succeeds
Identify
alternative
scenarios
Repeat twice
Refactor
Test against
observable
behavior
Test at the
right scope
If it’s not important
for the test, it’s very
important to hide it
Crystal-clear
cause and
effect
Reads like
a book
Copy two
times before
refactoring
Use fakes
when you
need to
eventMonitor.OccurredEvents.Should().BeEquivalentTo(new[]
{
new
{
EventName = "PropertyChanged",
TimestampUtc = utcNow - 1.Hours(),
Parameters = new object[] { “third”, “first”, 123 }
},
new
{
EventName = "NonConventionalEvent",
TimestampUtc = utcNow,
Parameters = new object[] { "first", 123, "third" }
}
}, o => o.WithStrictOrdering());
Command Handlers
Commands
Domain Model
Event Store
Events
App
Read Data
RavenDB
Projectors
Events
HTTP API
Projections
Events
Test Fixture
In-Memory
Event Store
Read
Data
RavenDB
Projectors
Events
HTTP API
Projections
Unit Test
HTTP request
Test Data
• Choose the appropriate type of
testing
• Care about the boundaries
• Write intention-revealing test
• Avoid DRY.
Dennis Doomen | @ddoomen | Aviva Solutions | The Continuous Improver
…then ping me at @ddoomen
…or email me at dennis.doomen@avivasolutions.nl

How to Practice TDD Without Shooting Yourself in the Foot