2 How contract testing fits into wider testing concepts
This chapter covers
- How contract testing fits into wider testing concepts
- Does contract testing replace other types of tests?
- Benefits of contract testing
- Introducing contract testing to your teams
- Challenges to be aware of with contract testing
- A practical guide on introducing contract testing to projects
Contract testing is unique. It sets itself apart from other testing types because it requires developing two sets of tests to fully reap the benefits. A consumer test can exist without a provider test but it won’t be useful. You can initiate the contract testing process by writing either a consumer test or a provider test individually, but it is important to note that these individual tests alone do not give you real benefits. In order to unlock the full potential of contract testing, you must implement and execute both consumer and provider tests in tandem, in a continuous integration pipeline ideally.
2.1 How contract testing fits into wider testing concepts
2.1.1 Unit testing
2.1.2 Integration testing
2.1.3 End-to-end testing
2.1.4 The ice cream cone of test automation
2.1.5 Contract testing in the test automation pyramid
2.2 Does contract testing replace other types of tests?
2.3 Benefits of contract testing
2.3.1 Cost saving benefits
2.3.2 Quality benefits
2.3.3 Team benefits
2.4 Introducing contract testing to your teams
2.4.1 Start with why
2.4.2 Start small and incrementally
2.4.3 Communicate benefits and progress visibly
2.4.4 Find allies or champions
2.5 Challenges with contract testing
2.5.1 It takes time
2.5.2 It requires a mindset shift
2.5.3 Lack of buy-in
2.5.4 More technical than other testing activities
2.5.5 Difficult when there are external teams
2.6 A practical guide on introducing contract testing to projects
2.6.1 Research what tools to use
2.6.2 Identify your consumers and providers
2.6.3 Define the contract
2.6.4 Write a basic consumer and provider contract test
2.6.5 Add contract testing to your CI/CD pipelines
2.7 Summary