2

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?

springbootlearner
  • 1,220
  • 4
  • 26
  • 48

1 Answers1

2

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.

agoff
  • 5,818
  • 1
  • 7
  • 20
  • can you share any sample bcos I can't find any example in Wirmock documentation. I am specifically looking for WireMock with Spring Boot and GraphQL integration. Apricate your reply. – springbootlearner Mar 06 '23 at 20:30
  • 1
    All of the documentation would be identical for GraphQL vs. a standard REST API. WireMock is set up to listen for _some_ network request, and respond in a certain way. You'll have to figure out the _"what makes one call different from another?"_ portion, and use the specific matchers. Based on my own experience with GraphQL, this would be the request body. – agoff Mar 06 '23 at 20:42
  • Yep --- usually will be relying on the request matching here for graphQL – Mark Han Apr 04 '23 at 17:31