We explain how the quality of features can be improved and the susceptibility to errors can be reduced through automated testing, and why the OpenAPI standard is a good option for distributed microservices. 

In a distributed microservice architecture, it is important to define how services are to communicate with one another and apply corresponding standards. After all, existing features need to be checked and adapted every time new features are developed. It is therefore crucial that communication between services is regulated so that the system isn’t damaged when changes are implemented. 

Within the allmyhomes system, RESTful API calls are used for all of the main communication between the different services and between those services and clients. REST is one of the main architectural styles that defines a set of standards to ensure that services can be used consistently from the word go. Allmyhomes uses contract files within the OpenAPI standard (contract) to define the service interfaces. In order to confirm that services are being delivered exactly as stipulated in the contract, allmyhomes runs automated tests on the interfaces using the contracts defined in the CI/CD pipeline. The next step involves a standardized process for generating finished code from the contracts for service communication, leaving developers to concentrate on developing the business processes.

As several teams are responsible for the various microservices within the allmyhomes architecture, contracts are written by lots of different people. It is on that basis that an internal standard has been set, with an automated contract validator ensuring that it is followed. Tools such as dredd.io and mock-server.com are used by allmyhomes in conjunction with tools developed in house to guarantee that all services can be tested separately and in isolation from one another. This way, all potential methods of communication are covered and validated, high quality standards are guaranteed, bugs are avoided, and new features can be implemented in no time.