folks! just to have a better overview for my plan ...
# general
a
folks! just to have a better overview for my plan so I make sure I don't start my pact adventure on the wrong foot 🙂 • I got an angular FE app • It talks to a graphQL (backend) service to fetch its data How should I proceed? Should I add the consumer project in the FE codebase right? And the provider in a separate repo? Then publish them to pactflow?
b
Hey @Ager Software, the first step would be to determine if you want to use consumer-driven contract testing or bidirectional contract testing. Both have their up- and downsides. Actually, the first first step would be to define your problem and see if contract testing is a solution to that problem 😉 But the contract testing flavour you choose has a big impact on the next steps, so let's do that first.
a
hee Bas thanks for reaching out! So the goal is to make sure that any BE changes won't break the FE (in a nutshell) So that means, the consumer-driven contract testing is the direction I should go right?
b
Well, it doesn’t have to be. The choice between CDCT and BDCT mainly depends on the amount of control you have over the provider code, the willingness of the provider to adopt and invest in contract testing, the depth and richness of verifications you want to perform and some other factors, too. If the BE code is under your control or developed in a team that’s easy to talk to and open to investing in contract testing, CDCT is definitely an option.
1
a
If the BE code is under your control - It is indeed. Both FE and BE (GraphQL) are definitely under our control. Developed in-house in our team, so not a separate/remote team.
b
In that case consumer-driven contract testing could be a good fit. Especially since your GraphQL API likely doesn’t have an OpenAPI like spec (and that’s the only format you can use as a provider spec at the moment as far as I know. So, consumer-driven it is I guess :)
The next steps I would recommend are documented here: https://docs.pact.io/pact_nirvana
a
Your help is very very much appreciated Bas! ❤️
1
In a very ''easy english'' stencence/s can you tell me what's the difference between CDCT and BDCT? I'm diving into PACT with a couple of my devs, and I need to get them up to speed the best I can before we start writing the first test/s.
Nevermind, I think I found my answers on your site!
b
Awesome. I think you're looking at this one? https://www.ontestautomation.com/approaches-to-contract-testing/
1
a
Precisely that one! splendid explanations ❤️
b
You're welcome 🙂
a
When I started my PACT investigations, the first idea I got was that both consumer & provider must write their set of tests & expectations, publish the contracts to PactFlow, and there was were the comparison was made, if those expectations match from both sides. But as we use GraphQL in my case, I believe too the best approach is to go the consumer driven way.
b
Yes, especially because BDCT (which is what you're describing) only supports OAS specs at the moment, and GraphQL is typically not documented with OpenAPI
1
a
Indeed!
b
Excellent. Good luck and feel free to ping me here if there's anything I can do.
1
a
sure thing, thanks again!
🙌 1