Questions tagged [pact]

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

pact
Filter by
Sorted by
Tagged with
1 vote
2 answers
1k views

Running PACT test is throwing a Ruby Load Error

I am trying to run a pact test for a typescript/angular service, from Visual Studio Code .I am getting the following error: ERROR (15568 ): [email protected]: Pact Binary Error: C:/projects/App/...
Mary's user avatar
  • 1,555
1 vote
1 answer
66 views

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 ...
user2451016's user avatar
  • 1,911
1 vote
1 answer
353 views

can-i-deploy fails on first new consumer build

I created pipeline in jenkins for building new consumer. In this pipeline after I build new consumer and publish new pact to pact-broker I invoke 'mvn pact:can-i-deploy -Dpacticipant=consumer-name -...
Roman Patrushev's user avatar
0 votes
1 answer
180 views

How to share pact file in bitbucket

I want to share the pact file from consumer to bitbucket and then provider can use from the same location. Does anybody implemented this? Thanks in advance.
RAHUL DESHMUKH's user avatar
0 votes
1 answer
539 views

Provider side maching not work on request body

Provider side matching is not working if I add any thing or rename or remove any field in request body of provider which is not same as contract then its not failing. Eg inside contract file request ...
RAHUL DESHMUKH's user avatar
4 votes
1 answer
210 views

How to implement a simple PACT-JVM solution on existing Scala code-base

We are trying to implement a Hybrid approach for PACT-provider for Scala. We're looking for a simple example of Pact-JVM-provider side implementation using PACT-JVM (Java variant) We've the project ...
user2451016's user avatar
  • 1,911
1 vote
1 answer
1k views

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 ...
keeping_it_simple's user avatar
0 votes
1 answer
691 views

Pact-python : Consumer pacts for POST calls are failing

I am trying to create consumer side pacts for a POST end point using the pact-python library. But it's failing with the error saying "Missing requests". Here't the client code which makes ...
Sree's user avatar
  • 11
0 votes
0 answers
130 views

./gradlew contractTest command get failed after add JPA dependency

This is my project structure samplePact.java package com.shoppingmall.cart; import static org.junit.Assert.assertEquals; import au.com.dius.pact.consumer.Pact; import au.com.dius.pact.consumer....
ben kwon's user avatar
0 votes
1 answer
400 views

Microservices Contract Testing without provider real API call

In Contract Testing for microservices, first we write mock Provider and create a json contract later this contract will be used to call real provider API call and test the contracts. Can we mock the ...
Santhosh Simha's user avatar
1 vote
1 answer
208 views

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 ...
diwakarb's user avatar
  • 561
3 votes
0 answers
228 views

Skip Preauthorise annotation for Pact test

Doing PACT testing for application having microservices architecture and test case is failing due to authentication. Either some way to skip authorisation or i'm not able to find where should i give ...
Ayushi Jain's user avatar
0 votes
1 answer
41 views

Automate a check that the message provider tests cover all scenarios in pact file?

In http based provider verification the consumer can be sure that if the provider verifies its code against the pact file (e.g. using the maven verify command), all scenarios (requests) in the pact ...
David Lewine's user avatar
1 vote
1 answer
3k views

Basic Pact/Junit5 Test Setup fails. No method annotated with @Pact was found for provider error

I tried to follow the documentation on Pact.io to write a simple integration test. Unfortunately i get an exception as follows: org.junit.jupiter.api.extension.ParameterResolutionException: Failed to ...
Kerem's user avatar
  • 589
0 votes
1 answer
177 views

Customise pactnet contract file name

In my pactnet consumer test, I state the contract as follows: PactBuilder.ServiceConsumer("My.Consumer.Application") .HasPactWith("My.Provicer.Application"); When the contract ...
runnerpaul's user avatar
  • 6,524
4 votes
2 answers
2k views

Pact Spring/JUnit5, "At least one pact source must be present on the test class"

I'm trying to create a pact verification test with Pact/Junit5. This is the example I started with: @Provider("myAwesomeService") @PactFolder("pacts") class ...
drone's user avatar
  • 43
3 votes
1 answer
157 views

scala-pact provider verification using specific service url

I'm trying to perform provider verification using scala-pact implementation. My dockerized service under test is located at http://localhost:9999/my_test_label/my_service. There is def ...
Klikam's user avatar
  • 31
0 votes
1 answer
216 views

how to parse the response at pact provider verfication

My scenario is that there are two interactions defined by the consumer, interation1 with state1, and interation2 with state2. After running interation1, there will be an id in the JSON response, and ...
zero_yu's user avatar
  • 503
0 votes
1 answer
462 views

Rewriting Pact contract test from JavaScript to C#

Apologies if this question is greaking the rules. I have this js class: src/get.js const { get } = require('axios') module.exports = function () { return get(`http://localhost:1234/token/1234`) } ...
runnerpaul's user avatar
  • 6,524
0 votes
1 answer
556 views

PactBroker throws java.net.ConnectException: Operation timed out (Connection timed out)

I have a pact broker server hosted at https://mytestbroker.com. I am able to browse the broker page. When I run mvn test, the contract test fails with Connection timed out error. curl -i https://...
user2176499's user avatar
1 vote
0 answers
260 views

pointing angular client to pact mock service

I use jest-pact and I try to create pact test for a service. I've already tried to point the service call explicitly to pact mock service (which I run on localhost:8181), but I got a pact verification ...
michal's user avatar
  • 29
0 votes
0 answers
409 views

Proxies for Jest and Pact

What is the equivalent of karma's proxies config option in Jest? I cannot find similar in docs. Previously we had something like this in karma.conf.js, which allowed us to use actual provider api ...
michal's user avatar
  • 29
1 vote
3 answers
1k views

is Provider-Driven Contract Testing possible with pact?

Is it possible with pact to let the provider create the definition of the contract and share it with consumers?
Massimo Da Ros's user avatar
0 votes
1 answer
162 views

Pact CDC: Cleaning up older consumer and provider version from Broker periodically

I have set up a pack broker locally and ran few iterations of consumer and provider. The list of verified pact over few days has gone to 100 now. I am looking for options to clear the contracts and ...
Deepti K's user avatar
  • 600
0 votes
1 answer
472 views

How to pact test an SSE endpoint (GET, "Content-Type": "text/event-stream")

My current application includes an SSE endpoint to allow streaming access to events occurring internally. That all works well, but we're like to do contract testing using pack for all endpoint and I ...
Jim Harrington's user avatar
0 votes
1 answer
438 views

Pact with SpringBoot

I am trying to follow the Baeldung Pact Tutorial with SpringBoot https://www.baeldung.com/pact-junit-consumer-driven-contracts I have one GET and one POST Method in my service as follows: public class ...
user1107888's user avatar
  • 1,505
0 votes
1 answer
736 views

generating pact contract: how to create PactDslJsonBody that matches anything

I am using Java to generate the Pact contract as a consumer. Here is an example of the response body that I would like the provider to verify { "metadata": { "href": "${...
zero_yu's user avatar
  • 503
0 votes
1 answer
424 views

fallbackTag doesn't work and code throws NoPactsFoundException

I am using 4.1.11 version of junit5 provider. <dependency> <groupId>au.com.dius.pact.provider</groupId> <artifactId>junit5</artifactId> <version>4.1.11</...
keeping_it_simple's user avatar
0 votes
1 answer
159 views

Does Pact.Net support https verification?

I want to verify my pact against an API that has an https endpoint. My request is timing out when I run the pact. Does Pact.Net supports https verification or am I missing something?
Marck's user avatar
  • 23
0 votes
1 answer
191 views

Pacts: How to match a sum / union type?

I have an api endpoint which shall return an array of a sum type. How can I write an appropriate matcher for it in pacts (javascript version, consumer site)? Example: Imagine we have the endpoint /api/...
Stephan Kulla's user avatar
0 votes
1 answer
514 views

Any examples of Pact testing with Kafka in .net

We have a project where we are consuming data from a compacted Kafka topic. The business is keen to use pact to cover integration testing across the suite of microservices. However as of yet we have ...
GingerBeered's user avatar
1 vote
0 answers
310 views

Handling a service call inside another service call in pact tests for angular (run with jest)

In an angular 9 project I have a service which calls an endpoint (call it endpoint_A) which starts a task running on the server and returns a task ID string as well as a header with a URL to check the ...
MWerner's user avatar
  • 11
1 vote
1 answer
1k views

How to run multiple .js test files together using npm (pact files)?

I come from a Java and Maven background and when trying to run multiple test files together and sequentially, I'm used to do something like this: mvn '-Dtest=com.my.directory.tests.*Test' test Where ...
Francislainy Campos's user avatar
0 votes
2 answers
491 views

Consumer driven contract testing vs behavior testing [closed]

I am not exactly able to understand how is consumer-driven contract testing different from behavior-driven testing? what is the pact server doing for consumer-driven contract testing that we have not ...
systemdebt's user avatar
  • 4,701
0 votes
1 answer
984 views

How to define multiple providers using @PactTestFor

We are using PACT library for contract testing. Current project relies on junit5 integration. I have to extend one test to use 2 providers instead of 1: Current version: @Test @PactTestFor(...
Lonestar's user avatar
0 votes
1 answer
2k views

NoSuchMethodException when using SpringRestPactRunner

I am using SpringRestPactRunner for the pact provider test. In the build.gradlew, I have put testImplementation 'au.com.dius:pact-jvm-provider-spring:4.0.10' In the test file, @RunWith(...
Betty's user avatar
  • 1
1 vote
1 answer
6k views

How to publish pact verification result to pact broker in gradle?

I have a service built with spring boot using gradle (gradle file at the bottom if needed) and Junit5. Many of the questions on stackoverflow are for maven and Junit4 and I have trouble translating ...
findusl's user avatar
  • 2,554
2 votes
1 answer
2k views

How to force Pact producer to verify a specific contract version?

I have a consumer that generated the first version of the Pact contract and it uploaded it to the broker. The producer verified that the contract and the verification were published to the broker. Now ...
mgryszko's user avatar
  • 566
0 votes
1 answer
410 views

How to write Pact contract that matches to key 'x' either object of type Y or Z

I try to write a pact contract test covering following scenario. I have a consumer calling an GET to receive an information about an animal, either a cat or dog. response1: { "animal" : { ...
DorianOlympia's user avatar
0 votes
1 answer
495 views

How to specify root level array, of minimal size and each object matching pattern

I have problems creating a DSL in pact, which will accept array of minimal size where each element matches given object pattern. I have no problems when I have an array inside a JSON object, then I ...
DorianOlympia's user avatar
0 votes
1 answer
264 views

Docker run command could not find the directory on the host

Trying to run a CLI command using a Pact image as part of Gitlab pipeline. However it is failing as Docker could not find the directory (target/pacts). Below are command and error details. Command: ...
Rob Wilkinson's user avatar
0 votes
1 answer
2k views

PACT: How to match specific dateTime format in pact jvm DSL?

Using pact jvm DSL with spring boot (.timestamp(name, format, example) I can specify both: .timestamp("start", "dd-MM-yyyyy'T'HH:mm:ss'Z'", Instant.parse("2020-10-06T20:48:58....
Aaron Shaw's user avatar
0 votes
1 answer
541 views

How can I break an Azure DevOps pipeline if integration tests running inside of a container fail?

I'm trying to create a build pipeline on Azure DevOps which is going to run a series of integration tests based on Pact .Net inside of a Docker container. How can I break this pipeline if any of these ...
Rogerio Schmitt's user avatar
0 votes
0 answers
48 views

make x ERR not found: make-.env running make mocked on Windows 10

I am trying to run this locally on my Windows 10 machine: https://github.com/pactflow/example-consumer-cypress I have installed npm on the root directory then run make mocked. However, I get the ...
ebanster's user avatar
  • 946
0 votes
1 answer
1k views

Pact provider verification fails with : For input string: "\null"

I am trying to validate on the provider side but getting error - Verifying a pact between DataConsumer and DataProvider [Using File pact/DataConsumer-DataProvider.json] Given some state a request for ...
Imakesense's user avatar
1 vote
1 answer
1k views

Pact: Error when trying to setup mock provider

I'm trying to write my first Pact-python test using pytest, Could someone please tell me what's wrong with my code? import unittest import requests import json import pytest import atexit from ...
Ajay George's user avatar
2 votes
1 answer
159 views

How to turn Pact HTTP Request interactions into Curl

I've been looking for a way to turn interactions for my Pact tests into a cUrl to easy debugging but not sure how to do that please.
Francislainy Campos's user avatar
4 votes
1 answer
2k views

How to inject dynamic id for Pact test from provider to consumer using REST Assured

I need to check an api of the type /meeting/id using Pact tests and REST Assured. The id may change and I'd like to create an item before the test and inject their id to overwrite what is set as part ...
Francislainy Campos's user avatar
1 vote
1 answer
995 views

measure pact test coverage of an API

Given the importance of automated tests I am wondering if there are possibilities to measure the test coverage for Pact tests. Remember that for unit tests, most frameworks/IDEs provide means to check ...
melli79's user avatar
  • 21
0 votes
1 answer
241 views

Pact Request That Depends on the Response from A Previous Request

I am using the Pact framework to test some APIs from a service. I have one API that initiates some backend execution. Let's call it request A and the response returns a unique execution ID. The second ...
RyanDing's user avatar
  • 407

1
4 5
6
7 8
14