Contract Tests with Spring Cloud Contract
Contract tests has a lot of significance and value in Micorservices world. You can keep fixing your end to end or integration tests, which runs very late in the build, are difficult to debug and cost lot of resources to maintain. Component tests are good for testing integration between the various components of an API. However, in microservices world there are a number of APIs that serves different/unique purposes and are part of an application/system. Component tests alone can’t assure that integration between micorservices is working fine. In case of Integration tests, testing a change in one API can lead to horrible time consuming process of setting up all the APIs, databases, brokers etc. Using Docker instances and Docker compose for orchestration makes things a little easier, however, it comes with a cost of maintaining your docker images and docker-compose files. Contract tests not only ensures that two APIs will behave nicely with each other, they also fail fast.