Learning Outcomes
Source Code
https://github.com/pact-foundation/pact-workshop-js
Step | Title | Concept Covered | Learning objectives | Further Reading |
---|---|---|---|---|
Create our consumer before the Provider API even exists | Consumer-driven design | Understand use case | https://martinfowler.com/articles/consumerDrivenContracts.html | |
Write a unit test for our consumer | - | How to write a basic unit test for an HTTP Client How to write a basic unit test for an HTTP Client | ||
Write a Pact test for our consumer | Consumer side pact test | Understand "Matchers" to avoid test data brittleness Understand "Matchers" to avoid test data brittleness | https://docs.pact.io/5-minute-getting-started-guide#scope-of-a-consumer-pact-test | |
Verify the consumer pact with the Provider API | Provider side pact test | Understand basic Provider-side Pact concepts Place provider side testing in a broader testing context (e.g., where it fits on the pyramid) | https://docs.pact.io/5-minute-getting-started-guide#scope-of-a-provider-pact-test | |
Fix the consumer's bad assumptions about the Provider | Humans talking to humans (collaboration) | Understand that a tool facilitates collaboration, it doesn't replace it | ||
Write a pact test for | Testing API invariants | Understand how we can test "stateful" APIs without having to create complex, sequential API calls | ||
Update API to handle | Provider States | How Pact deals with "stateful" interactions, via the concept of "Provider States" | ||
Write a pact test for the | Testing authenticated APIs | Service evolution - adding a new feature | ||
Update API to handle | Service evolution | Understand the challenge of dealing with complex/dynamic data, such as time-bound authentication tokens | ||
Fix the provider to support the | Request filters | Understand Pact's approach to dealing with complex/dynamic data, such as time-bound authentication tokens | ||
Implement a broker workflow for integration with CI/CD | Automation | Understand how to use Pact in a CI and CD workflow |