Questions tagged [pact-java]

Pact is a cross-language tool that provides Consumer Driven Contracts testing.

42 questions
20
votes
4 answers

What should be the scope of a Pact provider test?

My organization started to use Pact for creating/verifying contracts between REST services/micro services written in Java about half a year ago. We have a hard time deciding what the appropriate scope or grasp of a provider test should be and would…
Joel Andersson
  • 239
  • 2
  • 7
7
votes
3 answers

Should I test all enum values in a contract?

I have a doubt about about whether I should consider a certain type of test functional or contract. Let's say I have an API like /getToolType, that accepts a {object" "myObject"} as input, and returns at type in the form {type: "[a-z]+"} It was…
rrabio
  • 143
  • 2
  • 6
5
votes
1 answer

Pact: How do I match an object whose keys match a regular expression?

I am trying to write a pact consumer test to match the following response. [ { "accountId" : 1, "permissions" : [ { "schedule" : { "01/01/2018" : false, "01/01/1900" : true …
Quincy Bowers
  • 390
  • 2
  • 15
4
votes
1 answer

Using java to create PACT I am not able to set the min value of the numberType in the body

I am learning how to use PACT into my Java project and I would like to define some values restrictions on the expected output. For example, into one request /hello-world I am expecting to receive a number into the id attribute that should be always…
Thiago Mata
  • 2,825
  • 33
  • 32
3
votes
2 answers

pact-jvm : how to solve au.com.dius.pact.consumer.PactMismatchesException

I am trying to generate a pact between 2 of our services using pact-JVM. But when I try to run the Java class, I get this exception. 1) I suspect something is wrong with the Pact body, is that correct? There is an extra 'message' parameter in the…
ljs
  • 495
  • 1
  • 8
  • 23
2
votes
3 answers

No primary or default constructor found for Pageable in Pact Contract Provider test

I set up following pact contract provider test @RunWith(SpringRestPactRunner.class) @Provider("structures") @PactFolder("pacts") @VerificationReports({"console", "markdown"}) @SpringBootTest public class ContractTest { @MockBean private…
Ira Re
  • 730
  • 3
  • 9
  • 25
2
votes
1 answer

Pact provider doesn't send verification to Pact Broker

I am new in Pact (consumer-driven testing) and gradle, I used this famous workshop to try Pact with Java and Pact Brocker https://github.com/Mikuu/Pact-JVM-Example, but never works the final part when provider sends the verification to the Pact…
Alex2018
  • 21
  • 1
2
votes
1 answer

PactDslJsonArray root level arrays that match all items

I can successfully use PactDslJsonArray.arrayMaxLike(3,3) to create a pact that validates a maximum of 3 items returned. "body": [ { "firstName": "first", "lastName": "last", "city": "test", }, { "firstName": "first", "lastName":…
2
votes
1 answer

pact-jvm-consumer-specs2 - missing: [error] method: GET

I have problem with Pact JVM for spec2 consumer running with sbt. - What can be wrong? - I doesn't generate any pact file. given: sbt project with dependencies "au.com.dius" %% "pact-jvm-consumer-specs2" % "3.2.11" "org.specs2" %% "specs2-junit"…
1
vote
1 answer

Pact JVM check for a response that is either an array or null

I am trying to create a contract between with a consumer when making a request for an item information. The item has a very complex data structure with nested properties and contains fields that ranges from strings, lists, arrays of strings, arrays…
1
vote
1 answer

Pact Verification: Can i skip a particular providerState

Can I skip a particular provider state at the time of pact verification execution? like in my pact file I have 10 interactions and I want to skip an interaction or a provider state from StateChangeController. I'm using 'au.com.dius.pact.provider'…
dev-rgupta
  • 54
  • 4
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

Make pact-jvm support other protocols?

How hard is it to make pact-jvm support protocols other than HTTP, such as Thrift (https://thrift.apache.org)? In other words, is the implementation of pact-jvm tightly coupled to HTTP? Thanks.
jduan
  • 2,784
  • 2
  • 15
  • 9
1
vote
1 answer

Pattern match for individual parameters in pact-consumer tests

Using pact-jvm - Java so we have our api which responds with decimal/float values for few parameters. "body": { "status": "api is up.", "totalTime": 0.005939006805419922 }" I tried with regex match but pact body generate the data and that was a…
gammabowl
  • 31
  • 5
1
vote
2 answers

PACT : How to have dynamic path with valid data that is present in Provider DataBase

I have a restFul API http://localhost:8080/books/{id} which return a book with a particular ID. ex: GET http://localhost:8080/books/1 will return { "id" : 1, "pages" : 20, "price" : 100 } GET http://localhost:8080/books/2 will return { "id" :…
Sam
  • 181
  • 2
  • 3
  • 13
1
2 3