Hi all, I'm looking to start learning Pact/Contrac...
# pact-js
k
Hi all, I'm looking to start learning Pact/Contract testing and I have a question to see if contract testing is suitable for my use case. My company develops an API that is used by an external company, they can use our API to POST/GET data into our system. I'd like to know if I can use contract testing as part of our QA process to test as the third party, to ensure that the JSON objects being returned to the 3rd party are the correct shape and have the correct data types.
y
its not recommend with third party teams as they are usually out of your control but you can allow them to publish pacts to a broker, and use them to guide your development rather than block it. You can also generate example use cases as though you are a client, and use that as documentation for end users/integrators. You could then detect where contracts supplied by integrators differ from your own examples, and maybe initiate a conversation that way.
k
In my scenario, we wouldn't be working with the 3rd party at all, we just want to make sure that the contract we are offering them, as a provider doesn't break?
y
well if its a api you offer, and its considered public, you have to assume everything is being used. if the third party isn't going to be working with you, you won't get visibility into their usage and Pact won't be the right tool for the job
🙌 1
k
Perfect, that's exactly what I thought, thank you very much.
The API, does connect to an internal API we offer, would it best to place the contract testing there?
between the two APIS that are under our dev teams control.
y
Providing SDK's and a good onboarding experience, and having a mechanism to commuicate changes to an api (sandbox envs) are great. Just think about what you love when you use another API and things that give you gripes, and solve the former, quash the latter. within organisations where teams communicate is perfectly suited and all of our docs/examples support those cases, and suggest where failures occur, teams communicate in order to ascertain the way forward, contract testing is that early communicator to a change in intent of a service, be it intended (which promotes discussion) or unintended (which leads to remediation)
1
k
Thanks again!
no problem 1