hi guys if a create a RequestReponseObject and wan...
# pact-jvm
a
hi guys if a create a RequestReponseObject and want to use it to create pact contract json
m
Hi Ajay! Can you please add a bit more detail to your question? Are you asking how to write a pact test in Java or something else?
Just in case, here are some helpful getting started resources (examples/tutorials etc.) 👇 (howtolearn)
s
Here are a number of useful hands-on labs that teach all of the key concepts: https://docs.pactflow.io/docs/workshops and https://docs.pact.io/implementation_guides/workshops
a
i just want to create a pact json from RequestResponsePact object
iknow how to do it inside a consumer test with @pact method
but i want to automate the process and create pacts for multiple endpoints
m
What do you mean by automate the process?
a
by automating i mean instead of writing test cases for each endpoint and creating pact i want to do it programmetically
m
And why do you want to do that?
Or perhaps asked alternatively, why do you think that's a good idea?
a
i want to save time writing all these tests
i have api endpoints and expexted response
m
But the tests are the valuable thing. How will you ensure the contract is valid?
a
i want to validate only provider site
against the created pacts
m
But if the contract isn't valid, then those tests are also useless and you might as well use a different tool. How will you ensure the contract itself is valid if you skip writing the tests?
i have api endpoints and expexted response
If you have these and don't want/need to consider what the consumer does, then you're probably better off using a number of other functional API testing tools. Probably unit testing on the provider side is all that is required. Pact is about ensuring each consumer's needs are taken into consideration. What you're suggesting (I think) removes the consumer from the equation
I'm trying to get you to convince me it's a good idea, basically 😉