spriteTalk #87: Automated Contract Testing

spriteCloud
2 min readApr 29, 2021

Written by: Travis Hatridge

Our Senior Test Automation Engineer, Murilo is a wizard when it comes to automation. Fortunately for spriteCloud, he is also very good at training people on automation.

During our weekly Friday afternoon drinks and technical talks, what we call our spriteTalks, Murilo introduced automated contract testing to the spriteCloud team. During the presentation, he took us through some of the basics of what contract testing is, what it does, and why it is useful.

A brief explanation of contract testing

Contract testing exists to help with integration testing, which in turn is a process for testing that the various integrated systems (i.e. microservices) are all communicating and working together. A common example of such a test is an End-to-End Integration Test. In such an E2E test, all the components are testing together in an environment that closely resembles the production environment to test that they are function properly. These tests are generally more flakey, take longer to run, find bugs later in the dev process, and are very prone to failure.

An eCommerce platform is a great example of a system that depends on a lot of components working seamlessly with each other.

Contracting testing is a methodology whose goal is to ensure that two microservices are compatible and can communicate with each other. These interactions between the services are captured and stored in a contract, which is then used to verify that the microservices adhere to them.

What makes contract testing very interesting is that, unlike E2E integration tests, the microservices are able to be tested independently from each other and the contract is generated by the code, which means that it is always kept up to date. Thus is achieves the same goal as the E2E test but more reliably and more efficiently.

Sauce Labs has a good explanation of contract testing that you can use alongside Murilo’s presentation above.

In the classical test automation pyramid, E2E tests would sit at the “UI” tests level of the pyramid, which is slow to run and quite flakey. Contract testing would sit at the “API” or Service tests level of the pyramid as they as faster and cheaper to run and maintain and are less fragile.

Enjoy the video. If you have any questions, please leave a comment in the video.

If your organisation needs assistance in automating its tests, spriteCloud can help! We can lend out automation experts to your organisation for a short time to help set up test automation, or we can handle it for your completely. Learn more about our test automation services, or get in touch with us to learn how we can help you using the contact form below.

Originally published at https://www.spritecloud.com on April 29, 2021.

--

--

spriteCloud

We’re spriteCloud, a community of software quality assurance and cybersecurity testers located in Amsterdam. Put quality first!