Questions tagged [pact]
Pact is a cross-language tool that provides Consumer Driven Contracts testing.
663
questions
0
votes
0
answers
16
views
I have a 'interop exception' with a consumer contract test under dotnet
I had code working with pact v3. I have upgraded to pact v4, and have followed the instructions in the upgrade guide.
When I run a pact consumer test I get the following error:
Message: PactNet....
0
votes
1
answer
20
views
Provider side verification in Pact
Trying out pactflow with python. My consumer tests get published correctly, now for the verification side. Provider verification works as expected if I do this, with publish set to false:
# Define ...
1
vote
1
answer
31
views
How to verify field of type byte array (byte[]) through pact jvm?
I am currently writing contract tests for rest services using Pact jvm. One of the field in the response body in both consumer and provider is of type byte[] (byte array). I don't see any matcher for ...
0
votes
1
answer
10
views
Pact matcher based on typescript type definition
Pact Matcher api has a type based matcher 'like'
enter image description here
Does this matcher have something to do with the typescript type?
For example, if there are types
type TestType = {
...
0
votes
1
answer
31
views
How to develop a Pact Provider class without Spring?
I have already developed a pact file by running some tests on the consumer side. The question now is - how do I go forward with the development of the provide side? Am I supposed to mock the client, ...
0
votes
2
answers
69
views
Does anyone know how to create/write a PactNet verifier test using .NET Core 6+?
I recently heard about Pact and PactNet and it looks promising for testing micro services. Unfortunately, all of the documentation I can find as of today (11 Sept 2023) is painfully outdated and use ...
0
votes
1
answer
20
views
How to import dependencies in groovy inline scripts in maven
I wanted to add an inline groovy script in maven pom.xml.
Currently I am working with Contract Testing with Pact where I wanted to added a inline groovy script in to replace the auth token ...
0
votes
1
answer
16
views
Validate Provider Build Verification for the Consumer Pacts with dynamic auth token
Can someone help me understand, how this scenario is handled?
Here are the steps what I am following
Consumer pushed the Pacts to PACT Broker.
Once a new version is published, I trigger the Provider ...
0
votes
0
answers
27
views
In contract testing, provider test fails with TypeError: Cannot read properties of undefined (reading 'logLevel')
I've set up a simple endpoint GET /users/{id} that will respond to like so:
{
"email": "[email protected]",
"id": 1,
"name": "John Doe"}
My ...
1
vote
0
answers
14
views
getClient not present in @kadena/client
I tried following the kadena wallet connect example
However it can't import {getClient} from '@kadena/client'
This causes a failure when trying to get balances for the accounts
0
votes
1
answer
32
views
Pact Async Consumer Test is failing with message null
I am testing to create a Async Pact for a test application, that uses RabbitMQ I got the application running but the test to create the pact fails with the following error.
%TESTS 3,...
1
vote
1
answer
18
views
How to override npm dependency that is a ruby gem?
I am using @pact-foundation/pact-core:13.13.9. Struggling to update few dependency located deep inside the tree. eg: git which is a ruby gem.
Dependency git (1.2.5) located at Module ./node_modules/@...
0
votes
2
answers
98
views
Spring Boot - Java: Check backward compatibility of two given APIs by comparing two openapi contract files
I have a spring boot application and there I receive openapi contract files from the client side.
So, I have to compare the newly received contract file with the latest contract file (from the DB) and ...
0
votes
1
answer
63
views
Pact: use a query parameter on consumer side but exclude it from the contract
Imagine the scenario where the consumer production code under test is adding an API key as query parameter when calling the provider because it's required by some intermediate layers between the ...
1
vote
1
answer
52
views
Contract testing with pact, golang and xml response
How to write dsl matchers against xml response in golang using pact-go. The official documentation [https://docs.pact.io/implementation_guides/go] does not say anything about it. It has examples for ...
0
votes
0
answers
66
views
Pact verification failed - Provider test .NET
Hi I am trying to write my Provider test. I am setting up Provider State Middleware and using the Startup.cs file as demonstrated in the sample code. I get this error when I run my provider test ...
0
votes
0
answers
33
views
Error while installing binary: checksum rejected for file pact-1.63.0-linux-x86_64.tar.zip with checksum
When we try to download from artifactory facing issue with checksum /node_modu1es/pact/node_modu1es/@pact-foundation/pact-node/standalone/pact-
1.63.0-linux-x86_64.tar.gz
Extracting binary from /apps/...
1
vote
1
answer
54
views
Pact Net Pact Verification Failed with 404 response
I am testing a GET endpoint which is supposed to return 200 but it is returning 404, and the response header is also incorrect.
Here is the log:
Failures:
1) Verifying a pact between API Consumer ...
0
votes
0
answers
12
views
Generate response based on request
In PACT DSL, is it possible to access the request when generating the response?
What I want to do, is to copy some part of the request to the response. This would be very handy when launching the pact-...
-1
votes
1
answer
19
views
can u send code how to publish dot net contract in pact flow andverify at provider side code
I want a little help . I have less experience with automation. Can you send code on how to publish a contract in pact flow? and how to verify the provider-side code. really need very much .send code ...
0
votes
1
answer
32
views
contract_requiring_verification_published event not getting detected - Pact - Contract Testing
we are exploring around the things that are mentioned in the https://github.com/pact-foundation/pact-workshop-js and we have hosted the pact broker docker in the local machine, were we are able to see ...
0
votes
0
answers
40
views
Pact consumer test is shown in test explorer but does not run .NET
I am using PactNet.
I wrote a consumer test identical to this example on the github repo: https://github.com/pact-foundation/pact-net
using System.Net;
using PactNet;
using PactNet.Matchers;
using ...
0
votes
1
answer
54
views
How do I setup PACT with my .NET microservice
I want to setup Pact for my .NET service.
How can I set up PACT with the microservice?
Should I make provider tests, and how would I do this since I do not have consumer tests and therefore a contract ...
0
votes
0
answers
46
views
Writing response for Pact test for Grpc
Hi I am trying to use Pact to perform test between my services
The problem is that the response from my service provider is quite large and have complex structure
I tried to follow the Calculator ...
0
votes
1
answer
55
views
How to verify the consumer (REST API)
It is not clear how to verify the consumer pact with Mock assertion
In our case , we want to verify the consumer pact .
Our API's would allow the user to create Order and update order , etc
Hence ...
2
votes
1
answer
108
views
Pact Testing in Spring Boot | Error in installing the au.com.dius.pact:consumer:4.6.1 in Intellij
I am trying to learn Pact Testing but I am having issue in installing au.com.dius.pact:consumer:4.6.1 in Intellij.
I am using gradle for the build.
I am using this thing in the build.gradle file
...
0
votes
0
answers
54
views
How to get pact verification results across all the provider versions against a new consumer contract?
Lets say I have provider version 1 deployed in prod and version 2(latest code in main/master branch) deployed in staging. Now consumer has updated his side of contract and when the provider pipeline ...
0
votes
1
answer
31
views
@DefaultRequestValues replacement in pact jUnit5
I am trying to migrate my pact consumer tests from jUnit4 to jUnit5.
I've run across a problem with @DefaultRequestValues annotation, which is missing in pact-jvm-consumer-junit5.
In jUnit4 I was ...
0
votes
1
answer
25
views
Pact JVM, get array without any root as response
Using Pack for JVM using Junit5. Maven dependency that I have used is as follows.
<dependency>
<groupId>au.com.dius.pact.consumer</groupId>
<artifactId>junit5</...
0
votes
1
answer
101
views
pactFileWriteMode overwrite not working anymore in Pact
We got our Pact broker updated to 2.107.1 last week, but since then we are getting issues when we push any changes to pact with the same version number. Before this update it would just overwrite the ...
0
votes
1
answer
236
views
Failed at the @pact-foundation/[email protected]
Could anyone help me with installing pact-js
I'm trying to install @pact-foundation/pact. And I got an error in any version pact after 9 -
Failed at the @pact-foundation/[email protected] install ...
0
votes
1
answer
104
views
How to return json array with PactDslJsonArray in consumer tests?
I'm trying to write a consumer test and the following json array will be my response.
[
{
"additionalInfo": {
"details": {
"logo": "German Logo&...
0
votes
1
answer
117
views
Comparing object data to multiple example values from pact matcher typescript
I am using pact V3 in typescript to verify a contract with an API. The response example matcher is the following:
const userExample = {
email: string("[email protected]"),
id: number(...
0
votes
0
answers
23
views
How to test contracts between classes exchanging dictionaries?
Our organization uses many classes which are maintained by different teams and exchange dictionary collections. We want to make sure that the provider team will be notified when they break a contract. ...
0
votes
0
answers
111
views
Why stringMatcher works not as expected in Pact Test Spring Boot?
I have a stringMatcher as following:
.stringMatcher("id", "[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}")
My provider generates uuid value, but my ...
0
votes
0
answers
69
views
How to configure Jackson for Pact Test in Spring Boot Test?
I am trying to create Pact Test, my provider responds with incorrect data for consumer.
For example it responds with incorrect date format.
Consumer pact expectation: .datetime("created-at", ...
0
votes
0
answers
107
views
Is there a way to convert swagger json file into Pact contract file?
We are trying to implement CDCT in our project. But our team is not ready to implement separate test class to generate pact consumer contract file, but they do have already implemented and generating ...
0
votes
1
answer
48
views
PactNet - the type or namespace name 'PactVerifierConfig' could not be found
I'm trying to write a PactNet Provider test for my dotnet 7 web api.
I've installed the nuget package PactNet into my test proj and I see I have version 4.5 installed:
<PackageReference Include=...
0
votes
0
answers
130
views
One of the two identical consumer pact tests gets "expected status of 200 but was 404"
I created 2 identical consumer pact tests each consuming the same service of a provider. When I run provider contract test, one consumer pact passes but the other gets this error:
Verifying a pact ...
0
votes
0
answers
50
views
contract_requiring_verification_published event triggers webhook when content has not changed
Very new to Contract Testing, there's been a lot to try and get my head around.
However, I've managed to get pipelines in place for consumer and provider CI. I've also managed to incorporate the ...
0
votes
1
answer
141
views
How to upload consumer contract to official Pact Broker
I can do this using the following pom entry:
<plugin>
<groupId>au.com.dius.pact.provider</groupId>
<artifactId>maven</artifactId>
...
1
vote
0
answers
65
views
PACT Testing with Golang
I am trying to set up a simple example test for PACT via Golang.
I have this example server:
package main
import (
"fmt"
"log"
"net/http"
)
func main() {
...
1
vote
1
answer
101
views
Pact consumer test in Go. Issue with dsl.Match function
I am writing a Pact consumer test in Go. When I define the interaction I need to add the expected response object. The provider service is written in PHP and this is the response I am expecting:
...
0
votes
2
answers
100
views
"Skipping publishing verification results" error in pact for JUnit 4
When I run JUnit tests, contract tests run as expected but the results are not published to the pact broker. What do I need to do here? Here is the message I see on the console:
Skipping publishing ...
0
votes
0
answers
200
views
Walletconnect 2.0 signing requests on Kadena blockchain
I've been able to connect walletconnect to my eckoWallet by using the qr code, problem now is signing requests doesn't respond.
The code below contains two functions, first which is the walletConnect ...
0
votes
1
answer
70
views
How to Pact test a dictionary object
The below test will pass correctly, but if I post a body of {"a different key" : 4.56} it will fail as "key" is expected. In other words, the dictionary key is not flexible, only ...
0
votes
1
answer
180
views
pactdfoundation/pact-broker set up and listening on http://0.0.0.0:9292, but unable to connect
am running docker container for pactfoundation/pact-broker:latest
on a mac os x (13.2.1).
connected to postgres on mac with the right permissions (finally).
Last obstacle: when i try http://0.0.0.0:...
0
votes
2
answers
60
views
Pact testing nullable values
I want to test a nullable field with pact, so I have one test where
def test_post_1(pact, client):
(
pact.given("object doesnt exist")
.upon_receiving("a new post request ...
0
votes
0
answers
19
views
passing dynamic values to producer contract from consumer in the case of messaging
Is it possible to have a dynamic part on a spring cloud messaging contract, that is provided by the consumer?
To give some context, we have consumer C consuming both from producer P1 (via topic T1) ...
0
votes
0
answers
29
views
How to configure Pact to only allow positive integers?
Pact allows you to specify Like(1) when an integer value is expected.
For my use case I want to be more strict as I am dealing with positional data.
Therefore I want to only allow integers > 0 as ...