Hello everyone,
I’d like to get the community’s thoughts on best practices for testing the behavior of an application built with Axon, specifically around acceptance testing for event-driven applications.
Here’s the idea:
In the acceptance tests, we run the application, required DBs, and the event store in Docker containers, and we use MockServer to mock the external systems we depend on.
I’m considering the following approach:
- At the end of the test scenario, fetch the list of events from the event store and assert that the expected events were published.
- On the unit test level, use Axon’s testing libraries to verify that when a given event is published, the correct action is taken
My questions are:
- Do you think this is a good approach to validate the behavior of an application built with Axon?
- Is there a better or recommended way to write acceptance tests for an application built with Axon?
- In particular, should acceptance tests focus on asserting state changes and verifying that an external system was called correctly, instead of or in addition to verifying the events?
I’d appreciate any insights or examples from your own projects.
Thank you,
Alain