Testing Without Mocks
The article discusses a testing approach that avoids using mocks, instead focusing on testing with real implementations and event sourcing principles to achieve more reliable and meaningful test coverage.
Background
- Event Sourcing is a software architecture pattern where state changes are stored as an append-only sequence of events (e.g., "OrderPlaced", "PaymentReceived") rather than overwriting the current state in a database. This creates a complete audit trail and enables powerful replay capabilities.
- EventsourcingDB is an open-source database designed specifically for event-sourced systems, providing built-in projections, subscriptions, and querying for event streams.
- "Testing Without Mocks" argues that in event-sourced architectures, you can test business logic directly against event streams and projections instead of using mocked dependencies. This aligns with a broader trend in software testing toward fewer mocks and more realistic, state-based testing.
- The post likely contrasts traditional mocking (creating fake versions of external services/databases to isolate code during tests) with testing event-sourced systems by asserting on the actual events produced and the state of read models/projections.