Hey all, I wanted to check one thing regarding "Co...
# pactflow
p
Hey all, I wanted to check one thing regarding "Contract Testing". From what I understood, in Contract testing we take into consideration the STRUCTURE of the data as well as its datatypes. If there are 10 use cases all of which return the same structure of data, we will write only ONE contract test for it. Correct? I am trying to understand if say there are 100 tests that exist in a particular project, how do we understand how many contract tests need to be written?
b
As with every type of testing, there’s only one answer to the question of ‘how many’: exactly enough to give you the amount of confidence you need to reasonably assume that you didn’t break an integration. Without knowing more about your context, process, development and deployment practices and other things, it’s impossible to give you a number. Also, this is more suited for #C5F4KFKR8 I think.
👍 1
p
Lets say there are two API 1. GetEmployeeByID 2. GetEmployeeByEmail Both return: { Name: Prakhar, EmpID : 1 Email : abc@gmail.com Contact: 888-888-888 } In the above scenario there would be 2 unit cases : one for testing each endpoint. My question here is since we are getting same structure of data in return, do we write 1 contract test for this or 2?
b
It depends. Who are your consumers? Do they expect the same behaviour from both endpoints? If you’re going the consumer-driven route, your consumers decide on the number of tests (or scenarios, really). They might not even be aware that both endpoints have the same payload or the same implementation, and they shouldn’t have to.
🙌 1