March 2025
Intermediate to advanced
202 pages
4h 45m
English
Aggregates accept commands and, depending on their current state, will return 0 or more events. As a pure function, this looks like the following:
| | f(state, command) = e1 ... en |
As a result, it should be easy to write tests that supply scenario states and commands and assert the results. One of the most common failures in aggregate testing comes from the aggregate reaching outside of the event stream for additional metadata such as a running clock.
Countless automated testing frameworks exist that have their own advantages and disadvantages. The criteria for picking a testing framework to test your aggregates is that it should be easy to test your aggregate’s pure functions. This comes with an implicit requirement that you ...
Read now
Unlock full access