I am new to PACT and trying to use pact-java for contract testing for a java microservice. I understand the concept of consumer test which generates a pact contract file and uploaded it to the broker.
Now I have a question about provider side testing. I read that the provider tests are run against the actual service. So I start the provider service in a container environment in my pipeline before tests are run. My provider service interacts with a database and based on the value obtained from the DB do some logic processing and replay with the response.
These are the api's I need to do the provider side testing
1. POST api to create a new transaction. This API will respond with a unique transaction id and owner id.
2. POST api to get the base encoded value of transaction .The request accepts the transaction id and own id in the request body and validate against with db and if the details provided in the request is correct respond with base64 encoded value if the entry is not present in the db respond with a 404 status code.
I have create a provider test for the api 1 but for the API 2 to test I need the transaction id and owner id obtained as response of API test 1.
Qn1 : Do need to run the provider api against the actual server in a test docker container in pipeline.
Qn2 : Do we need to mock the service layer in the provider service as we interested only in the contract
Qn3 : How to get the provider testing 1 response and it can be used as input for provider side test 2