Spring PetClinic Contract Testing Reveals Hidden API and Test Infrastructure Gaps
Full stack developer Kuruba Ramesh, interning with Specmatic, integrated contract testing into the Spring PetClinic REST project, which exposes 18 API paths and 36 operations backed by an OpenAPI 3.0 spec. Running Specmatic's JUnit 5 test suite generated 221 scenarios, of which 214 passed and 7 failed, uncovering real gaps in the existing API design. A POST /visits failure was traced to a missing petId foreign key in the request schema, which was resolved by introducing a dedicated VisitCreate DTO and a corresponding MapStruct mapping. Six DELETE operations then surfaced 404 errors instead of expected 200 responses, pointing to a deeper issue in the test infrastructure rather than the API logic itself. The exercise demonstrated that contract testing can expose limitations in test setup and data lifecycle management, not just API correctness.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.



Discussion (0)
Log in to join the discussion and vote.
Log in