5 Implementing consumer-driven contract testing for mobile clients
This chapter covers
- Pact Consumer Setup for Android Apps
- Android consumer test implementation
- Android consumer contract generation
Chapter 4 covered consumer-driven contract testing for web clients using Pact version V3. However, if you are a mobile developer or tester, you will want to understand how to implement consumer-driven contract testing (CDCT) in your native language. In this chapter, we will use Kotlin and Gradle to walk through the implementation steps of CDCT in an Android-native application using Pact version V4, from setting up the interaction and applying best practices to generating the consumer contract.
If you have a strong understanding of the foundational concepts from chapter 3, it's time to start implementing contract testing. In our experience of working with mobile applications within a microservices environment, it’s important to take care of external APIs interacting with the mobile app. Mobile apps are released in a bundled version at a point in time but not every user updates the app at the same time. Good coverage around the contracts is key to providing a seamless experience for the user.