← Graph

How do you test units with dependencies on other units?

question 2 connections

Audience asks how to test units that depend on other units — mocks, substitutions, or something else. Krzywda: avoid inter-unit coupling as much as possible; when needed, use simple fakes or stubs. Because all building blocks produce either events or commands, tests simply assert what appeared on the command bus or event store — you can use a fake command bus to check commands were dispatched.

answer_summary
Prefer avoiding coupling. Where needed, use simple stubs/fakes. Assert on events produced or commands dispatched to a fake command bus — that's usually all you need.
question How do you test units with dependencies on other units?
about
Command Bus concept
Answer: use fake command bus and assert events/commands.
question How do you test units with dependencies on other units?
asked_at
Asked during Q&A.

Provenance

Read by
1 extraction