How to test non event sourced aggregates?

Hi all,

the aggregate test fixtures currently seem to work only for event sourced aggregates. Is there any test code or examples on how to test aggregates with standard repositories?

Kind regards,


Hello Frank,

the Fixtures were intended for Event Sourced Aggregates. We do have plans to make that more flexible, but it’s not the #1 item on our backlog.
You can use “generic” unit tests to test your aggregates. Axon will need an AggregateLifeCycle in certain cases. You can use the StubAggregateLifecycle class to use a stub.

When using JUnit, just declare an @Rule field:

public StubAggregateLifecycleRule lifecycle = new StubAggregateLifecycleRule();

You can then use the lifecycle to validate whether expected events were published.