Hi all, I am looking into implementing contract te...
# general
m
Hi all, I am looking into implementing contract testing within a new project. The thing is: we are developing our api's using a contract first approach. And the contracts themselves are part of a separate git repo. I'm looking for any documentation or examples of such projects so that we can determine how we could implement contract testing on this project. If anyone has any tips, please let me know 🙂
👋 1
t
What’s in your contract files?
I would say Pact is contact-first. As in, the consumer defines the contract
☝️ 1
m
If you mean OAS, it's an orthogonal concept to pact. You can use them in parallel but you can't use them to drive pact tests.
One option is to combine Pact (to prevent breaking changes and help safely evolve the ecosystem) and/or use tools like Pactflows bidirectional contract testing (supports OAS) or the https://www.npmjs.com/package/@pactflow/swagger-mock-validator tool to prevent for OAS from drifting from actual usage
m
Hi, thanks for the responses, sorry for my late reply. I was away for a week. We define our contracts ourselves and use OpenApi to generate the endpoints and DTO's. So I am guessing that there is not much added value to use pactflow.
m
t
An OpenApi spec isn’t really a contract. It doesn’t define behaviour, and it typically allows lots of requests or responses that wouldn’t actually be acceptable
You don’t need contract testing, but without it you will need to be ultra careful about how you test and deploy. How do you know for sure that there are no breaking changes when you update the schema? How do you know that the changes are backwards compatible etc?
m
How do you know the version of your SDK matches the version of the provider contract that generated the SDK? This was the big problem with SOAP - we generated SDKs from the WSDL, but that just now meant we had to deploy clients and servers at the same time, because the implementation detail was hidden away
m
Hahah ok, Thanks for the links. I will dive into them 😄
👍 1