pact-foundation / pact-jvm

JVM version of Pact. Enables consumer driven contract testing, providing a mock service and DSL for the consumer project, and interaction playback and verification for the service provider project.
https://docs.pact.io
Apache License 2.0
1.08k stars 480 forks source link

Failed to invoke provider method in async pact test #1665

Open shaship04 opened 1 year ago

shaship04 commented 1 year ago

Verifying a pact between PED_A2CO_MERCHANT_CONFIG_REQUEST [Using File ../pacts/PED_A2CO_MERCHANT_CONFIG_REQUEST-PED.json] Given Merchant-Config create {"TimeStamp":"2023-02-07T23:04:58.676+05:30","message":"[Controller id=0] Processing automatic preferred replica leader election","Thread":"controller-event-thread","Level":"INFO"} generates a message which Verification Failed - Failed to invoke provider method 'verifySuccessMessageEvent'

i am not getting the exact steps and what is this error mean? could you please help why this exception occured.

rholshausen commented 1 year ago

The way async message tests work, you provide a method that will return the message to be verified, and the Pact framework will call the method and verify the returned message is correct.

In your case, Pact called your verifySuccessMessageEvent method, but it failed with an exception. That is what the error Verification Failed - Failed to invoke provider method 'verifySuccessMessageEvent' means.

Now, to your question could you please help why this exception occured, I can't comment on that as it is your code that failed, not the Pact framework. You would need to look at the logs to see what the exception was and try work out why your verifySuccessMessageEvent is failing.

If you are using Spring/Springboot, it could be that a dependency was not wired in correctly.