Hello! I have three questions about the global Pac...
# pact-net
m
Hello! I have three questions about the global Pact conception. 1. Please, tell me, should I separate pact files demands on provider features? For example, I have an API for the Task Manager application and implemented API by feature architecture on the C# language. Such as TaskCrud (CRUD operations on tasks), TaskFilter (filtering tasks) etc. And SPA React application, where I write contact tests. So my question is, should I have a single pact file (e.g.
task-api-consumer-task-api-provider.json
) for checking responses to all features from the provider side or better split generating pact files depending on provider features (e.g.
task-api-consumer-task-api-provider-crud.json
and
task-api-consumer-task-api-provider-filter.json
) and after that writing two verification test methods on the provider side for each coming pact files? 2. Where should I save the pact file path? Is reading from a configuration file (such as launchSettings.json) for a test project better than C# constant? 3. If a consumer has many providers, which algorithm is better to use if I need to publish one pact file to a specific provider? Depend on the pact file prefix, or save the pact file in a particular folder during generation on the consumer side on passing tests? Thanks, Maksym
1
m
1. Per provider 2. Doesn't matter, lock an ephemeral dir in the project, you should use a pact broker 3. Publish all of the contracts for each build to the broker. The broker will determine if things have changed
💯 1
See howtonirvana
s
See this page on the steps to creating an effective contract-testing setup https://docs.pact.io/pact_nirvana. (This workshop demonstrates those principles in action: https://docs.pactflow.io/docs/workshops/ci-cd/)
m
Got it, thanks a lot!
🙌 1