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
1
vote
1 answer

Negative smoke tests / defect seeding for validating PACT implementation

We're implementing Pact framework for testing couple of microservices (Scala Backend & iOS-Android Frontend). So to test the Pact implementation itself, what sort of negative tests / defect seeding we can do to make sure that - the implemented Pact…
user2451016
  • 1,857
  • 3
  • 20
  • 44
1
vote
1 answer

pact matcher for different number of elements in array

I have an endpoint which returns following type of response: "0": { "array": [ "items", 2, "item1", "item2" ] } Currently I have written pact matcher like following: o.object("0", o1 -> { o1.array("array", a1 -> { …
keeping_it_simple
  • 439
  • 1
  • 11
  • 31
1
vote
1 answer

How to integrate pact-jvm provider only with json file

I want to test my spring-boot Rest API by using a pact json file provided. The thing is all the resources on internet points to verifying using pact-broker. I will get there but currently, working on a POC for this is turning out to be quite…
diwakarb
  • 543
  • 2
  • 9
  • 23
1
vote
1 answer

How to update dynamic date on body for post params within JVM PACT contract?

I have a POST request that takes date as a param from within my contract file for a PACT test. return builder .uponReceiving("A request to create a Zoom meeting") .path(createMeeting) .method("POST") .headers(headers) …
Francislainy Campos
  • 3,462
  • 4
  • 33
  • 81
1
vote
1 answer

fail to publish to Pack-Broker: duplicate key value violation

We are now facing a problem when re-publish pacts to the broker when the version and tag remain the same, but the content of the pact is changed between (re)publish trials Recently our CICD started using a completely new pact broker server, that…
IgalK
  • 21
  • 5
1
vote
1 answer

stringType matcher in V3.0 contract for AMQ message does a literal match instead of type-matching

I have a contract that uses stringType to match a filename. The contract also specifies the matcher on type, but when I run the test on the provider side, it does a literal match. I've included the contract, the JSON that is send and a screenshot…
Blitzoff
  • 133
  • 4
  • 11
1
vote
3 answers

Conceptual questions regarding usage of pact

I am the part of a team that is "pioneering" the usage of pact for our whole company. On this journey we faced many issues that were mostly due to misunderstanding the usage of pact for CDC-Testing. A lot of those questions could be solved over…
1
vote
1 answer

How to generate same matching rules for "arrayMinLike' using lambda Dsl for Pact?

I have a sample body as below; [ "01/01/2019", "01/02/2019", "01/03/2019" ] I'd like to validate the following: 1. The response should be an array with at least 1 element 2. Each element should be: 2.1. String 2.2. Should be in this…
Sam Vo
  • 113
  • 10
1
vote
1 answer

PactDslJsonBody is failing to create JSON object

@Pact(provider="Appointment_Provider",consumer = "Appointment_Consumer") public PactFragment createFragmentAppointmentDetails (PactDslWithProvider builder) throws ParseException{ Map headers = new HashMap<>(); …
Nisha
  • 11
  • 4
1
vote
1 answer

Pact JVM update backwards compatibility

I am trying to update dozens of services to au.com.dius:pact-jvm-consumer-junit_2.12:3.5.12 from au.com.dius:pact-jvm-consumer-junit_2.11:3.2.13 but it seems that the new consumer version is generating pacts that the old provider version…
Yunior
  • 13
  • 3
1
vote
1 answer

Convert Java POJO into PactDslJsonBody

I am trying to write a helper class to get PactDslJsonBody from a Java Pojo directly. However, it fails to create nested Json Objects. Can someone explain me why?Below is my code : HELPER CLASS CODE - used to convert input java pojo to…
PaChSu
  • 297
  • 3
  • 13
1
vote
1 answer

Why mvn pact:publish throws NoClassDefFoundError kotlin.TypeCastException

i'm trying to publish a Pact-File to my Pact-Broker with maven-plugin this way (taken from github…
Vegetto313
  • 11
  • 1
1
vote
0 answers

pact-jvm mockserver hits connection limit

I am generating a rather large pact file. A parameterized test appends a single interaction to the pact file for every line in a csv document. Unfortunately, the mockserver created with the @Rule PactProviderRuleMk2 locks up after 200 tests when it…
Mike Adler
  • 1,199
  • 9
  • 24
1
vote
0 answers

Contract tests not working for microService with two different Contracts (messagePact and RequestResponsePact)

I have two different contract mS scenarios: 1st- Direct mS-mS Contract testing where i'm using RequestResponsePact to create Pact. 2nd- There is a mq between two microServices called Kafka where i'm using MessagePact to create Pact. I am not being…
Nivethan
  • 23
  • 5
1
vote
0 answers

Pact Groovy Mock with Array in Body

I would like to model my much such that its body consists of an array of n elements. The below code only creates one element in the array, when it should produce three. withBody(eachLike(3, { id identifier state("COMPLETED") type…
bengro
  • 1,004
  • 10
  • 19