This article explores the case of the usage of artificial intelligence (AI) for optimizing the process of covering distributed systems with consumer-driven contract test, analyzing the pros and cons of this approach. Considering the complexity of development of modern distributed systems, like microservices, and the need to ensure the system components interactions keep reliable as long as the system keeps evolving this study is focused on finding the most effective way to introduce the contact testing into such systems to maximize the contracts tests coverage while minimizing development costs. The contract testing has its challenges: steep learning curve, impact on the delivery lifecycle, spreading the approach consistently across the organization. These challenges often lead to teams sacrificing the benefits of the approach and using more traditional ways of testing, like end-to-end (E2E) testing, which however does not fit well into distrusted system. The described methodology includes generating (by AI platform) the contract between the parties (consumer and provider), generating the consumer test to verify the provider is compatible with the expectations the consumer has of it. It is proposed to use following inputs for AI as the source for generation: request-response pairs, OpenApi specification, consumer codebase. The research employs Pact as a tool that allows to define a contract between a consumer and a provider as well as verify that both sides adhere to this contract. NodeJS is used as a framework for consumer and provider development. PactFlow platform with its HaloAI executes contracts and tests generation. The proposed approach simplifies the road to introduce the contact testing into the distributed systems, increases the development team effectiveness in system implementation and a confidence in its stability
Read full abstract