Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Contract Testing #2990

Open
meierw opened this issue Feb 28, 2024 · 4 comments
Open

Contract Testing #2990

meierw opened this issue Feb 28, 2024 · 4 comments
Labels
Priority 4: Would Lowest priority. Would-be-nice to include issues when time allows it. Type: Feature Use to signal an issue is completely new to the project.

Comments

@meierw
Copy link

meierw commented Feb 28, 2024

Feature Description

We (my team and I) are looking for a Contract Testing lib/framework for Axon Framework based services. Something similar to Pact or Spring Cloud Contract.

But at the moment it looks like there is no such dedicated tool. The aforementioned Pact only works with JSON messages ad Spring Cloud Contract doesn't have Axon Framework in it's supported messaging integrations.

Current Behaviour

No dedicated way to define Contracts for testing between separate Axon Framework apps, which are communicating with each other via the messaging bus.
Each service must Assume what the consumers will send and what they expect.

Wanted Behaviour

A way to define Consumer Driven Contracts for sharing among services, to make sure services can be tested in isolation, and to make sure new deployments handle the consumer needs based on the Contract.

Possible Workarounds

  • We can of course make some custom solution with the current tools. We already share the Message classes among services. By adding some metadata (Contract information) and some custom code that evaluates said Messages + Metadata, we could get the needed functionality. But at that point we are building this library that we are looking for. It could be a nice OSS project to share with the world, but we want to make sure we are not reinventing the wheel here.
  • There is an example of someone using Spring Cloud Contract with Kafka, so perhaps something similar can be made for Axon with a little bit of custom code?
    https://softwaremill.com/contract-testing-of-event-driven-application-with-kafka-and-spring-cloud-contract/
  • There is also an example project for Pact tests done one Axon Framework apps, but it only works because the messages are serialized in JSON. This is not sufficient as it locks us in to JSON Messages, and we already are using other serializers due to specific needs.
    https://github.com/idugalic/axon-contract-testing-demo
@meierw meierw added the Type: Feature Use to signal an issue is completely new to the project. label Feb 28, 2024
@smcvb smcvb added the Priority 4: Would Lowest priority. Would-be-nice to include issues when time allows it. label Feb 29, 2024
@smcvb
Copy link
Member

smcvb commented Feb 29, 2024

Thanks for providing this feature request, @meierw.
Interesting idea to have a more dedicated way for contract testing in Axon Framework (or perhaps as an Extension).

As it stands, the team is mainly focused on maintenance for Axon Framework 4 and the development of Axon Framework 5.
Sadly, I am inclined to give this issue a low priority right now, due to our obligations.

Note that doesn't mean you or anybody else isn't free to provide a pull request for such functionality. It just means the Axon Framework team cannot at this stage.

@meierw
Copy link
Author

meierw commented Feb 29, 2024

Hi @smcvb .

Thanks for the response. That is very understandable.

Importantly your answer breeds confidence that we would not be reinventing the wheel if we added this new functionality ourselves.

Then my follow up question would be. Which is preferable, a pull request or a new extension/library? The way I see it, if we gave you the code via PR, we would also give you the burden of maintenance, in case there are some issues in the future that other users/developers find with the implementation. That could potentially burden your dev team later. Thoughts?

@smcvb
Copy link
Member

smcvb commented Feb 29, 2024

That could potentially burden your dev team later.

Although true, I think that's a natural part of maintaining an open-source project. :-)
Concerning the topic of maintenance, I am not fully sure yet what this functionality would entail if I am being very honest.
Perhaps when seeing a PR, things would become clearer in that perspective.
Taking our time into consideration is very kind of you, of course, and thus much appreciated! 🙏

Which is preferable, a pull request or a new extension/library?

If the Contract Testing requires dependencies on other tooling, it would be best suited as an extension.
If it's pure Java code, or very close to it, a PR to the Axon Framework repository would be fine.

@meierw
Copy link
Author

meierw commented Feb 29, 2024

Understood. Will keep that in mind.

Will see what we come up with, and of course we can deliberate more when we have some POC presentable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority 4: Would Lowest priority. Would-be-nice to include issues when time allows it. Type: Feature Use to signal an issue is completely new to the project.
Projects
None yet
Development

No branches or pull requests

2 participants