The test automation pyramid suggests that we should favour unit and integration tests over end-to-end tests, which leads developers to use test doubles (fakes, stubs, mocks etc.). The risk is that the developer's test double does not behave in exactly the same way as the actual component that it is replacing. When this happens, the tests all pass in your build pipeline, but you get failures when it's released into an integration (or production) environment.
Contract testing is a technique that can give you confidence that your test doubles are accurately simulating the dependencies that they replace. This is not a new technique, but the extra investment in creating and maintaining (yet another) suite of tests has restricted its uptake. Instead, organizations mitigate the risks by investing in more and more integration environments and end-to-end tests. This was always expensive, but with the adoption of micro-service architectures across the industry, the cost and complexity has escalated to a point where this approach is no longer sustainable.
There is now an urgent need for organizations to revisit contract testing, with a specific focus on consumer driven contracts for micro-services. This need led to the creation of the Pact open source tool for HTTP based micro-services. The Pact project has created a multi-platform suite of tools that dramatically simplifies the adoption of contract testing.
In this session, you'll learn why contract testing is critically important, look at how you can incorporate contract testing in your development practices, and get an introduction to Pact.
Consultant, coach, trainer, analyst, and developer for over 30 years - Seb has been involved in the full development lifecycle with experience that ranges from Architecture to Support, from BASIC to Ruby.
He’s a BDD advocate with SmartBear, helping people integrate all three practices of BDD into their development processes and ensuring that appropriate tool support is available.
Regular speaker at conferences and occasional contributor to software journals. Co-author of the BDD Books series "Discovery” and "Formulation" (Leanpub), lead author of “The Cucumber for Java Book” (Pragmatic Programmers), and contributing author to “97 Things Every Programmer Should Know” (O’Reilly).
He blogs at cucumber.io and tweets as @sebrose.