Pact is a cross-language tool that provides Consumer Driven Contracts testing.
Questions tagged [pact-net]
31 questions
7
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
- 143
- 2
- 6
5
votes
3 answers
PACT .NET consumer test: flexible length array
I am using pactNet to test an API which should return an array of a flexible length.
If i call "myApi/items/" it should return a list of items where the consumer does not know the exact size of.
So the answer should look like this:
[
{
…

Kevin Schäfer
- 53
- 5
4
votes
1 answer
Should I use pact based stub service or Wiremock.net?
I am researching tools for Component Testing for Microservices in the dotnetcore world.
Along with Component Testing I am planning to do Contract Testing as well using Pact.net.
While reading Pact.net…

Vikas
- 404
- 5
- 18
4
votes
2 answers
Validate types in PactNet
I am testing micro services and I'm using PactNet to create and validate pacts. I am finding that the tests are too brittle, as the verifier is checking for exact values and not verifying the types.
For example, I am testing against the GitHub API…

Karl Gjertsen
- 4,690
- 8
- 41
- 64
2
votes
1 answer
How to programmatically launch a .NET 6 minimal API with no Startup class
I am trying to implement PactNet contract tests on our provider project. However the issue is that we are using a Minimal API so instead of having a Startup.cs and Program.cs class we just have it all rolled into one Program.cs.
This poses an issue,…

Imer Muhović
- 109
- 1
- 8
1
vote
1 answer
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 and Weather API Given There is data - A GET…

Sienna
- 83
- 8
1
vote
0 answers
XUnit and Pact Verification Unable to see out for pact verification failure
I am following the PactNet workshop example given at https://github.com/DiUS/pact-workshop-dotnet-core-v3/
I have no issues with Consumer side code. All tests are passing and a pact interactions file is being generated.
However, the tests are…

DevOps
- 11
- 1
1
vote
1 answer
Contract testing on dictionary of objects
I'm trying to write contract tests for an object that contains a dictionary of objects. I want to verify the entries respect my contract. The keys are changing between the consumer and provider. Right now, the matching rules of my contract are…

Sophie Bossé
- 11
- 2
1
vote
2 answers
PACT - Handling provider service state and running actual provider with mocked or actual database
I am new to PACT and trying to use pact-net for contract testing for a .net microservice. I understand the concept of consumer test which generates a pact file.
There is the concept of a provider state middleware which is responsible for making sure…

rochitsen
- 402
- 6
- 18
1
vote
1 answer
Can I use Pact broker for Functional Tests?
I have a service that receives a request, generates an email, saves the email to message queue (to be sent by other microservice) and returns httpStatus.Ok.
I want to test that for different requests a relevant email will be generated.
According to…

Michael Freidgeim
- 26,542
- 16
- 152
- 170
1
vote
1 answer
How to ConfigureServices in Asp.Net core WebAPI from another assembly
In a microservice environment I need to construct a framework for Contract based testing.
I'm currently investigatingh how to isolate a single service from it's external dependencies inorder to execute the Provider tests.
What I need to do is:
Keep…

terle
- 86
- 10
1
vote
2 answers
Pact matcher that would check both a regex as well as null
I have the below pact file with following interactions
"interactions": [
{
"description": "I call fixture service using a valid fixture Id",
"providerState": "a request to check the api response",
"request": {
"method": "get",
"path":…

makil
- 489
- 2
- 7
- 19
1
vote
1 answer
Start-Process : The system cannot find the file specified from TeamCity Build step but works fine locally
i am trying to run Pact broker can i deploy tool with paramaters which is working fine locally but when i add the build step in TeamCity it is throwing below error
Start-Process : This command cannot be run due to the error: The
system cannot …

beginner
- 39
- 7
1
vote
1 answer
how to run PACT Broker can-i-deploy script?
i have downloaded the zip file https://github.com/pact-foundation/pact_broker-client#can-i-deploy and running the below command in my bash but i am getting error, what i am doing wrong
my plan was to run this can-i-deploy from C# code but before…

beginner
- 39
- 7
1
vote
2 answers
PactNet Provider test fails because of 404 when running the test
I have a consumer that has successfully created a pact file:
{
"consumer": {
"name": "CakeService"
},
"provider": {
"name": "CoolPersonService"
},
"interactions": [
{
"description": "A GET request to get a person who is…

sb_w
- 11
- 1
- 5