Integration with other systems is one of the most complex parts of software delivery. Is there a silver bullet that can address issues like flaky tests, unstable environments and non-trivial bugs that slow down the development?
It is very rare to have an application that is not integrated with other systems. This also applies to AEM application development. In many cases, we don't have control over those other parties. Such APIs are maintained by other teams or even companies. Sometimes they are not maintained at all. On the other hand, they might not exist when we start our delivery.
Those external APIs might be unstable, which can lead to unpredictable behavior of the entire system. It can be unclear what is the root cause of a bug: if it was introduced in the external API or our application. E2E and integration tests that we have in our project might fail from time to time without a straightforward reason (timeout, network issues, unstable environments, etc.).
We can use stubs for those systems. However, then we don't have confidence if the integration works well. We can integrate directly, but then it is hard to distinguish where the problem is. Luckily, there are a few good options to explore.
All the code samples and configuration in Gradle can be found in the pact-example project on GitHub.