graphqlwiremockspring-cloud-contractspring-graphql

Does WireMock support Mocking GraphQL APIs


We have multiple micro services which is based on GrapQL and few of them based on REST and each micro service will call multiple other microservices (Java, Spring Boot tech stack). Now we want to write integration testing for this kind of orchestration.

We thought of using WireMock for Stubbing external Micro Services. But does it support GraphQL? As Wirmock will will support REST MS mocking can it be used for Stubbing GraphQL as well when using with Spring Boot?


Solution

  • Yes, WireMock supports GraphQL. WireMock allows request matching based on almost every bit of data sent in a network request (in the case of GraphQL, most likely the request body), and so you can set up WireMock to respond differently based on the information in the request body.