Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consumer using PactJS and Provider using PactJVM issue with interactions filtering #1773

Closed
rakeyshc opened this issue Mar 3, 2024 · 1 comment

Comments

@rakeyshc
Copy link

rakeyshc commented Mar 3, 2024

This is more of a question than a issue to be honest.

My consumer application which is a single page application uses Pact JS to product the json file by naming my consumer as
frontend-project-name for a service-1-backend-project-name.

My consumer i.e. frontend interacts with different endpoints on the same service-1-backend-project-name. All the interactions I make end up in the same consumer file as per the OOTB pact behaviour I hunch.So for example if I am executing the tests for states
a. get details of the item id
b. getAll items
c. create item
d. delete item
e. update item

  1. get details of the key id
  2. getAll keys
  3. create key

So in the Above my consumer json file will have a + b + c + d + e + 1 + 2 + 3

Now on the provider side i have a Pact JVM Spring based implementation for service-1-backend-project-name as provider and my requirement is to obliviously test the contract layer here but problem is now after introducing

interactions 1 , 2 and 3 above

My Provider test class 1 i.e. ItemsProviderTest starts to expect the interactions for 1,2,3

whereas

My Provider test class 2 i.e. KeysProviderTest starts to expect the interactions for a,b,c,d,e

I am not able to understand how can I neglect or filter only test states for given test methods in a particular provider class.

I tried using
@IgnoreMissingStateChange but the provider test class still reads all the interactions

rificationStateChangeExtension$Companion : Did not find a test class method annotated with

image
@rakeyshc
Copy link
Author

rakeyshc commented Mar 4, 2024

@PactFilter("matching string")

@PactVerifyProvider("matching string") does the trick

@rakeyshc rakeyshc closed this as completed Mar 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant