Hi Team, We are using PEGA to build consumer appl...
# general
b
Hi Team, We are using PEGA to build consumer applications. Let's say Application A and Application B. We have created stubs for application A using Simul8r and performed contract testing with provider and which is successful. While building Application B I have used Application A as buit on application ( Built on application - We can call Application A as a read only and we can use the entire functionality of Application A inside) I have two questions on Performing contract testing on Application B. 1. Should we create stubs for Application B again which we have created in Application A and performed contract testing? Should I create same stubs which I have created for application A and perform contract testing again for the same ? 2. Can we create common stubs for both the applications in a common palace which can be accessible for both applications? Can anyone explain how to perform contact testing for the above scenario. @Matt (pactflow.io / pact-js / pact-go)
m
I’m not entirely following, sorry. Are you saying you have two consumers with the same backend, and should you share the “stub” from one consumer for the other?
Also, please avoid tagging individuals, we monitor the workspace regularly and will respond if/when we’re available.
b
Hi Matt apologies for tagging individuals, not the same backend. I will rephrase my question. Can we create stubs for our consumer applications at a common place to perform contact testing?
m
no worries!
So you could, but what problem is that solving? If you have to write consumer contracts anyway for each consumer, the stubs are relevant to each consumer and may independently change over time (despite the fact that they may be aiming to use exactly the same APIs)
b
Thanks for explanation Matt. Developers in our team building consumer applications with overlapping functionalities and they wanted to build stubs at a common application so they don't have to rebuild common stubs multiple times. Does this violate the contract testing principles test your application in isolation ?
m
The stubs are a by-product of creating the contract tests, so yes I would suggest sharing the stubs is probably violating the philosophy. It should be safe to do (sharing the stubs), however, because the stubs are (hopefully) validated contracts (that is, they provider should be validating them).
1
b
Thanks Matt for the detailed explanation. This resolved my question.
🙏 1