Questions tagged [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.

JVM implementation of the consumer driven contract library pact.

From the Ruby Pact website:

Define a pact between service consumers and providers, enabling "consumer driven contract" testing.

Pact provides an RSpec DSL for service consumers to define the HTTP requests they will make to a service provider and the HTTP responses they expect back. These expectations are used in the consumers specs to provide a mock service provider. The interactions are recorded, and played back in the service provider specs to ensure the service provider actually does provide the response the consumer expects.

This allows testing of both sides of an integration point using fast unit tests.

This gem is inspired by the concept of "Consumer driven contracts". See http://martinfowler.com/articles/consumerDrivenContracts.html for more information.

Read Getting started with Pact for more information on how to get going.

Source: https://github.com/DiUS/pact-jvm/

109 questions
0
votes
1 answer

Newb pact JVM provider

Hope someone might be able to help me, been beating my head against the wall for a while and can't seem to break through. I have tried following multiple examples and doing endless searching, just can't seem to find out what I am missing. There…
Btah
  • 1
  • 2
0
votes
1 answer

Is there a way to add pact interaction into to JSON file and add to consumer test code in JAVA

We have a requirement that we need have a pact standalone server and interactions (request/ expected response pairs) in a JSON files and store it in a directory and just add to consumer tests and generate a pact file. I would like to know if this…
0
votes
1 answer

Can we create consumer tests and generate pact file without access to consumer code

I am test automation engineer and new to PACT. My questions is I have a frontend and a backend. Frontend sends a request and get response from backend. I would like to create consumer tests and generate a Pact file, but I don't have access to the…
0
votes
1 answer

Unauthorised error when publishing java contract to pact flow using jenkins

I have a contract that we can publish to the pact flow broker okay when running mvn pact:publish -Dpactbroker.auth.token=myToken. However, the same contract and maven command gives us an authentication error when running it from Jenkins. Not sure…
Francislainy Campos
  • 3,462
  • 4
  • 33
  • 81
0
votes
1 answer

How to test pact with null data

I am aware of that PACT expects provider data need to be in our control, but I am facing following situation I have pact contract for multiple consumers, all have some mandatory attribute and some are optional attribute, but business logic suppress…
LowCool
  • 1,187
  • 5
  • 25
  • 51
0
votes
1 answer

How to share pact file in bitbucket

I want to share the pact file from consumer to bitbucket and then provider can use from the same location. Does anybody implemented this? Thanks in advance.
0
votes
1 answer

Provider side maching not work on request body

Provider side matching is not working if I add any thing or rename or remove any field in request body of provider which is not same as contract then its not failing. Eg inside contract file request body contain name field and the same field if I…
0
votes
1 answer

how to parse the response at pact provider verfication

My scenario is that there are two interactions defined by the consumer, interation1 with state1, and interation2 with state2. After running interation1, there will be an id in the JSON response, and this id has to be used as the query parameter of…
zero_yu
  • 493
  • 5
  • 15
0
votes
1 answer

generating pact contract: how to create PactDslJsonBody that matches anything

I am using Java to generate the Pact contract as a consumer. Here is an example of the response body that I would like the provider to verify { "metadata": { "href": "${host}", "id": 40964176, "updated_at": {} }, "record": { …
zero_yu
  • 493
  • 5
  • 15
0
votes
1 answer

fallbackTag doesn't work and code throws NoPactsFoundException

I am using 4.1.11 version of junit5 provider. au.com.dius.pact.provider junit5 4.1.11 As per the documentation, I am specifying both tag and fallbackTag…
keeping_it_simple
  • 439
  • 1
  • 11
  • 31
0
votes
1 answer

NoSuchMethodException when using SpringRestPactRunner

I am using SpringRestPactRunner for the pact provider test. In the build.gradlew, I have put testImplementation 'au.com.dius:pact-jvm-provider-spring:4.0.10' In the test file, @RunWith(SpringRestPactRunner.class) Test failed message: Verifying a…
Betty
  • 1
  • 1
0
votes
1 answer

Pact provider verification fails with : For input string: "\null"

I am trying to validate on the provider side but getting error - Verifying a pact between DataConsumer and DataProvider [Using File pact/DataConsumer-DataProvider.json] Given some state a request for json data Request Failed - For input string:…
0
votes
1 answer

Test Pact provider for json structure only

Looking at Pact for some contract testing, our Real api's have timestamps in the response, so I was looking to validate against the json schema only. In the example here -…
0
votes
2 answers

How to write a pact test for an interface, which is not used by the most recent consumer anymore?

I have a weird situation and I have no idea how to handle it: Let's say I have a consumer C and a provider P. We did not use Pact, when we implemented these services. So here is the problem: An older version of C needs a specific interface of P,…
KnechtRootrecht
  • 493
  • 1
  • 4
  • 18
0
votes
1 answer

Using service in Pact consumer test with Java EE

I'd like to implement a Pact consumer test in our Java EE application. This test shall invoke a consumer service method which would trigger the actual REST call. Here's the Pact test so…
Robert Strauch
  • 12,055
  • 24
  • 120
  • 192