Questions tagged [pact]

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

A Contract is a collection of agreements between a client (Consumer) and an API (Provider) that describes the interactions that can take place between them.

Consumer Driven Contracts is a pattern that drives the development of the Provider from its Consumers point of view.

Pact is a testing tool that guarantees those Contracts are satisfied.

pact.io

658 questions
2
votes
1 answer

Passing parameters from Jenkins CI to npm script

When I run Jenkins build, I would like to pass COMMIT_HASH and BRANCH_NAME to one of my javascript files: publish.js, so that I can remove hard-coded values for tags and consumerVersion. Here is my code: Jenkinsfile stage('Publish Pacts') { …
Angelina
  • 2,175
  • 10
  • 42
  • 82
2
votes
1 answer

Consumer-Driven Contract Testing Databases

I recently learned about consumer-driven contract testing to supplement complex integration/E2E testing. I would like to verify my database and service are in sync through a contract. Is someone aware of how to do this?
Chip
  • 23
  • 2
2
votes
2 answers

Example junit5 pact message provider test

I have been able to convert message consumer pact tests to junit5, but am not sure how to use the information in the junit5 provider readme to convert the corresponding message provider verification tests. Can someone point to an example or suggest…
David Lewine
  • 101
  • 2
  • 12
2
votes
1 answer

How to implement the "or()" method in dius.pact

i am writing a pact test and I need a variability. this is my actual method for defining an price object: private static LambdaDslObject definePrice(LambdaDslObject object) { return object .stringType("type") // <--- could be empty or has 2…
m1well
  • 716
  • 4
  • 15
  • 28
2
votes
1 answer

Pact Dsl - provider returning more records than in pact file

I have the following classes:- public class Student { private String id; private String firstName; private String lastName; private int age; } public class DepartmentResponse { private String id; private String name; List
ShefZee
  • 95
  • 7
2
votes
1 answer

PACT testing: correct way to write PactDslJsonBody

I have the following JSON format { "file": { "version": "v1.4", "release": "1.1" }, "status": "ON", "document": { "status": "NOT_FOUND", "release": "undefined" } } and I would like to know how I…
marhg
  • 659
  • 1
  • 17
  • 30
2
votes
1 answer

Pact test on Junit5 what to define in @ExtendWith

I am starting with Pact testing, I have already my Consumer contract test and generates the JSON pact file. The example I am following, has a test that runs the Pact file, Here is the example code I am following, it contains the provider (bs),…
marhg
  • 659
  • 1
  • 17
  • 30
2
votes
1 answer

Pact Testing PactProviderRule not detected

I am starting with Pact test, and I followed the example from Pact-JVM-Example, then I created my own test The Producer returns, the data from a user (a very simple JSON) { "id": 1, "firstName": "name", "lastName": "last" } The consumer test is: …
marhg
  • 659
  • 1
  • 17
  • 30
2
votes
1 answer

Consumer Driven Contract Tests for C++ APIs

I am developing a static C++ library that has some Public APIs. I have to implement Consumer Driven Contract for the APIs that the library provides. But in my case I have to provide the contract to the consumers on which they will agree upon. The…
Seeker
  • 101
  • 2
  • 10
2
votes
1 answer

@SpyBean not working with Pact and JUnit 5

I'm trying to use the @SpyBean to mock a method of a @Component and doesn't work. @MockBean works (followed the example). I've tried, read and researched many ways but couldn't make it work. Here's the example: @SpringBootTest(webEnvironment =…
talabes
  • 5,344
  • 2
  • 22
  • 27
2
votes
0 answers

How to modify request body in POST during Pact provider verification?

Is it possible to modify parameter values defined in the body during provider verification? The pact wiki(https://github.com/DiUS/pact-jvm/tree/master/pact-jvm-provider-junit#modifying-the-requests-before-they-are-sent-version-323245) provides a…
LoL
  • 41
  • 5
2
votes
1 answer

Pact: Write different interactions with same endpoint

I have a situation where I wrote 2 interactions with same endpoint. Even though I am passing different query in with_request option, i am getting below error - Error: Multiple interaction found for GET /a1/configurations?includeDeleted=true& First…
Amit
  • 41
  • 2
  • 9
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
2 answers

Error with Typescript Pact.io test: PopsicleError: Unable to connect to

Expected: Running npm run pactTest should generate a pact file (JSON). Results: I get an Unable to connect error. Pact.io JavaScript implementation guide. Pact.io Typescript test example. Appreciate any thoughts or ideas as to what I'm doing wrong…
Leon Gaban
  • 36,509
  • 115
  • 332
  • 529
2
votes
1 answer

Pact provider tests broken: pactVerificationTestTemplate » PreconditionViolation

I'm quite new to CDC testing and only make my first steps. I've deployed the Pact-Broker (docker-compose), running at localhost:80. The consumer sends the generated pacts successfully to the broker, but it seems that the provider can't get a valid…
Tagira
  • 31
  • 1
  • 3