Comments (4)
I think this raises the question "what sort of testing do we want pact to support?".
IMO (so far, I may be persuaded otherwise!), the best use of pact is to test the provider client in an isolated test. If every call to your provider goes through your client class, and you have tested every method of your client class then
- you should be able to have confidence that your end to end integration will work
- you avoid the combinatorial explosion problem that happens when you introduce integration tests - you have tested each scenario once and only once, meaning your tests scale linearly.
If your client returns a model, then all the other tests that interact with the client only need to know about the model, and that can be verified against the model that the client returns in the pact test by using the same factory to produce both the model in the pact spec, and the model that is returned in the test where the client is stubbed.
So, if I don't like the idea of using pact in end-to-end Capybara style tests, then how do I think we should run Capybara style tests? I haven't worked that out yet...
Maybe there should be two pact modes? One, the current way, where we require that the entire request is specified, and we record the expected request in the pact, and Two, where you specify the minimum request data required to uniquely identify the request, and the response, and then record the entire request in the pact.
from pact-specification.
I don't think we need to consider testing the whole consumer as an integrated codebase to answer this question.
Rather we should answer the question of whether we want to support the consumer specifying non-strict matchers in the requests they send. (which somewhat contradicts Postel's law)
If the answer to that is yes (I can see it being useful for library generated headers, security tokens url's etc) then Ron's solution is the best I've seen for having a value to use in the provider test.
I'm trying to think of where non-strict consumer data would be of significant value and not coming up with many answers.
I can't see how a test with the eventId known in advance would be a problem.
I don't think we really want to support random test data, that's more appropriate for a Janus(quickcheck) type library.
from pact-specification.
Timestamps and third party security libraries were the first thing I thought of, however my general feeling is that time should be stubbed in all tests and third party security libraries are still generally deterministic
from pact-specification.
Why do you think that we shouldn't consider testing the whole consumer? Testing a rich client UI that uses a JSON REST API using capybara is a pretty typical use case.
from pact-specification.
Related Issues (20)
- Events driven architecture like aws event bridge contract testing HOT 1
- Feature Request - eachLike(itemDescriptionWithMatchers, exampleArray?) HOT 4
- Definitive word on PACT and HATEOAS HOT 1
- V4 Pact Specification Metadata format changed HOT 3
- Guidance and documentation needed to differentiate between event messages and command messages? HOT 1
- Pending pacts and can-i-deploy HOT 5
- Option to check for no undeclared fields HOT 3
- Generated pact file body include json_class, contents information and doesn't have matchingRules section HOT 2
- V4: Tracking issue for support of synchronous messages HOT 6
- V4: add a boolean matcher
- Matchers don't work with SSE response format HOT 1
- Question: providerStates allowed in any contract? HOT 1
- Type of regular expressions used in pact HOT 2
- How to match xml elements with namespace ? HOT 3
- Serialisation of ProviderStateGenerator HOT 2
- Add number range matcher
- json schema for version 3 pact files HOT 2
- The V4 Specification Retrospectively Alters the V3 Specification for Matchers and Generators HOT 6
- Either matcher in Pact HOT 2
- Convert PACT file to OAS 3.0 file HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pact-specification.