Search code examples
spring-bootintegration-testingpact

Testing REST API provider response without mock


Currently, I am working on a project on Spring Boot where we are integrating with external REST API. As part of our integration suite test, we are doing the mock test of the actual external API which executes as part of the CI/CD.

My question is in production it calls the actual API so, how we can do that in the test environment. I don't think we need to make the actual external provider call during multiple integration test which will load the external API, also at the same time would like to test with actual REST response from the service.

Any suggestions?


Solution

  • If the public API has a swagger description, you could use the Atlassian Pact Swagger Validator. I describe the workflow in this talk: https://www.youtube.com/watch?v=79GKBYSqMIo#t=39m10s