Vinny Gray
Vinny Gray

Reputation: 547

Spring Contracts with third-party or non-Java applications

We are planning to use Spring Cloud Contracts to test our service endpoints. As per the typical workflow, we will create contracts and generate stubs on the provider side, which will be used to create the consumer stub tests and provider verification tests.

My question is, can we use these same stubs to test providers that are third party services, either on prem or off? Also, can we use these stubs to test Node and Python based service providers?

Upvotes: 1

Views: 775

Answers (1)

Marcin Grzejszczak
Marcin Grzejszczak

Reputation: 11149

Yes you can. Please read my blog post https://spring.io/blog/2018/02/13/spring-cloud-contract-in-a-polyglot-world where i describe how to do it with nodejs. In general you can use a docker image in case where the non jvm project is a consumer or a producer. We also describe how to do it in the documentation.

Update:

It seems i have misunderstood the question. If it's related to the third party projects / apis you don't own then i can suggest the following approach. You create a test that goes to the external api via a proxy, you record the stubs and publish them as a jar (https://github.com/spring-cloud-samples/the-legacy-app/tree/master/stubs_with_proxy). Then the stub runner on a consumer side can fetch them. Here you can see my presentation about this https://www.youtube.com/watch?v=ZyHG-VOzPZg and the slides https://docs.google.com/presentation/d/1Je_IZ-xjLnOHf5YgH0r4ihlqhIrob6fC0NBT95xDHoo/edit?usp=sharing

Upvotes: 3

Related Questions