Questions tagged [pact-java]

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

35 questions
16
votes
3 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…
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
  • 350
  • 4
  • 12
3
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,262
  • 28
  • 27
3
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
  • 103
  • 1
  • 6
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
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
  • 381
  • 1
  • 6
  • 17
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

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,204
  • 2
  • 15
  • 30
1
vote
1 answer

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
  • 528
  • 1
  • 5
  • 19
1
vote
1 answer

How to generate mock server for pact consumer from contract json file?

I want to use contract file from provider to run tests against consumer. I have { "provider": { "name": "Provider" }, "consumer": { "name": "Consumer" }, "interactions": [ { "description": "Get data", "request": { …
Stepan
  • 43
  • 1
  • 7
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,456
  • 2
  • 11
  • 7
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
  • 4
1
vote
1 answer

Why is this pact-jvm provider test failing?

We’ve got a provider test that is only failing on Jenkins, which is preventing me from debugging. Here are some relevant logs from Jenkins: Error Message 0 - $.body.2 -> Expected name='FXUHHqWrZZcodhHBmeLf' but was missing 0) a request to get all…
Fitzoh
  • 756
  • 1
  • 6
  • 12
1
vote
1 answer

PactDslJsonObject getting resolved to Empty Map {}

The object, below, while debugging is being displayed as {} instead of {"types" : ["Ice Cream"] } as one would expect. Why is this happening. PactDslJsonObject resquest = new PactDslJsonObject() …
Antho Christen
  • 1,169
  • 8
  • 21
1
2 3