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
4
votes
1 answer

SyntaxError: Unexpected identifier - GraphQLService

I'm just stuck on this one particular issue and hoping someone might be able to help, my ide is complaining about a syntax error Unexpected identifier, Im assuming I have a typo somewhere, but am at a loss to find it. Error message: ● Test suite…
Jake
  • 91
  • 5
4
votes
2 answers

Publish verification results to pact broker is not working in pact-jvm-provider-spring_2.12

I am trying to publish the verification results to pact broker with pact for jvm/spring. I am using junit4. The test is executed and passed, A verification report is printed to console/ json file is added, but it's not publishing the results to pact…
yoka791
  • 576
  • 5
  • 17
4
votes
1 answer

Handling nextRelease version in semantic release

so I have been reading the docs and kind of got a glimpse of what I should do, but no real grasp of how I can do it. Here is my problem: - I am using semantic release to publish my package to npm - I also have contract testing in place with Pact. -…
Moustachiste
  • 412
  • 4
  • 14
4
votes
2 answers

Contract Testing for AWS Lambdas

Is there any way to do Contract testing for the AWS lambdas. Pact is being used for normal APIs, But I am trying to implement Contract Testing on AWS SAM. Is there any tool for this or Pact can be used with any modifications?
user3602058
  • 219
  • 4
  • 10
4
votes
2 answers

How and if test syntactic (bad request) validation with Pact?

I'm starting to use Pact (on Java) for Contract Tests. I've read Contract Tests vs Functional Tests on Pact best practices but I'm a little confused. Example: a simple REST endpoint that creates a resource (POST), returning a 201 Created on success…
4
votes
2 answers

NUnit: Fail Test when OneTimeTearDown fails

Abstract goal: I’m working with NUnit (3.9.0 at the moment). Some work to finish the tests is done in the OneTimeTearDown method. When this work fails, I need an indication, i.e. one or more tests should fail. Background: I’m implementing PACT Tests…
kryz
  • 116
  • 8
4
votes
1 answer

Using java to create PACT I am not able to set the min value of the numberType in the body

I am learning how to use PACT into my Java project and I would like to define some values restrictions on the expected output. For example, into one request /hello-world I am expecting to receive a number into the id attribute that should be always…
Thiago Mata
  • 2,825
  • 33
  • 32
4
votes
1 answer

pact: how to check a a field in the response that may or may not exist

I have a service that will respond to a request with a json blob, such as this: { "field1": 1, "field2": "2", "array": [1,2,3] } I know that I can test array by using EachLike, like this: expected = { "field1": Like(1), "field2":…
ewok
  • 20,148
  • 51
  • 149
  • 254
4
votes
3 answers

Pact JVM Java unclear newbie / starter /tutorial project?

Is there a small and concise jvm consumer Java (consumer or provider) junit project that somebody could share, preferably in a self contained zip file with all files contained, except for the jar imports? When I follow for example the steps here:…
zombieboy
  • 116
  • 1
  • 10
4
votes
3 answers

Pact File Not Generated Inspite of test being Passed

I am trying to generate Pact file.The test is passing when is "Run As-Junit Test" in Eclipse. However, unable to really understand why the Pact Contract File is not generated. Can you please help? Below is my test code: package pact; import…
PaChSu
  • 297
  • 3
  • 13
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
3
votes
1 answer

Problems with Mock Server when running Pact with Jest

I am trying to use Pact in my Angular 13 workspace with Jest for writing contract tests. I am using latest version of Pact which is v10.4.1. However, I am running into problems related to Mock Server. It seems that Mock Server is not receiving any…
3
votes
2 answers

How can I use fromProviderState with path parameter in Pact?

I am new to pact consumer testing. I am creating consumer pact using JavaScript. To verify with provider I need fromProvderState path parameter. I am using pactV3, here is the code .given('set id', { id: 52}) .withRequest({ method:…
3
votes
1 answer

PACT Testing: Unexpected Request body: 500

I have a request class which has this fields: private final String pk; private final String sk; private final List tags; private final ZoneId timeZone; private final String pattern; private final SomeEnum action; private final String…
Yamini
  • 67
  • 1
  • 6
3
votes
1 answer

Pact consumer junit5 - No ParameterResolver registered for parameter [au.com.dius.pact.consumer.MockServer mockServer]

I am figuring out how to implement consumer driven contract testing using pact junit5. But the test keeps failing because of no parameter resolver for the injected MockServer, even though the test class is extended with PactConsumerTestExt. My…
Divyaa
  • 45
  • 1
  • 6
1
2
3
43 44