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
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

how to create PACT for multipart/form-data uploading cdc test

I`m trying to create cdc test for uploading file verifying. I use DIUS library. I do not find any examples how to work with .withFileUpload() in DIUS. My code for pact is next: @Pact(provider = PROVIDER, consumer = CONSUMER) public…
Valeriy K.
  • 2,616
  • 1
  • 30
  • 53
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 Contract Test :How to generate dynamic PactDslJsonBody using json value?

How to generate dynamic PactDslJsonBody using json value? Is it possible Pact team can provide the auto builder to assign body dynamically? Pact Body: body(new PactDslJsonBody() .object("testsuite") …
Nandess
  • 25
  • 1
  • 10
2
votes
1 answer

How to model named arrays and objects in Lambda DSL for Pact (pact-jvm-consumer)

The Json below contains three things that I don't know how to model in the lambda based DSL for Pact (and that I can't figure out by reading the examples provided on https://github.com/DiUS/pact-jvm/tree/master/pact-jvm-consumer-java8 ). The…
2
votes
1 answer

PACT provider verification against public APIs

am trying to do test for consumer driver contract testing using pact jvm and able to generate consumer side contract file.During provider side verification, how to provide public API's instead of localhost most of the examples uses only localhost as…
Laiku
  • 21
  • 2
2
votes
1 answer

Pact JVM closeArray

I have problems with closeArray in pact-jvm-consumer. Given Json like this, how would the "DslPart imeiResults = new PactDslJsonBody()"-statment be constructed. { "Car": { "Price": 123, "Features": [ "rain sensor", …
2
votes
1 answer

Contract Tests for APIs which involve session or workflow

Hi I am trying to write Contract Tests for a product purchase workflow. So obviously i cannot call the Checkout API directly without calling Add to Cart API. But as I have observed the verification hits the paths individually might not be in the…
PaChSu
  • 297
  • 3
  • 13
2
votes
0 answers

How to generate a Pact file with a response body matching a array of Strings with groovy

I'm new to Pact and new to groovy too. I want to write a Pact to hand it to a provider. The provider should answer on a given request with an array of strings like ["foo", "bar", "foobar"]. Here is my working state, which is stripped to the…
Papillon
  • 31
  • 1
  • 4
2
votes
3 answers

Spring mock testing in Pact

I am trying to adopt Pact. I understand the consumer side of the equation and it looks very nice. But I am confused about the producer side. It seems the documentation advocate running the provider app, and verifying the contracts against a running…
Arash
  • 11,697
  • 14
  • 54
  • 81
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

How to do a pact contract verification test from a json contract

I know to do pact verification using @pactBroker(host="hostname", authentication="someAuthtextInbase64") where all the contract details are present and I can connect and verify. Now I want to run a pact test without involving the pact broker as…
Santrupta Dash
  • 269
  • 2
  • 15
1
vote
0 answers

Pact consumer test does not successfully mock the spring webclient request using the created pact

I am new to Pact Contract testing and I am trying to create a Pact consumer test to validate a method that calls an api with get request. The api request is made using Spring Webclient. I am not able to create the webclient object by just providing…
sysons
  • 11
  • 1
1
vote
0 answers

"Your project is misconfigured" error when publishing results of provider verification with Gradle and Kotlin

I posted this in GitHub 14 days ago but have had no response. I'm hoping a StackOverflow user might know the answer? When I run gradle pactVerify -Ppact.verifier.publishResults=true I am getting an error: Your project is misconfigured, was…
johnsgp
  • 103
  • 1
  • 8
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