Say we have a remote Alpha service, with the GetUser (id, includePurchases) method.
The method has this rule:
- If includePurchases is true, user.Purchases must have a shopping list.
- If not, user. The acquisition must be empty.
Let's say we have a beta version of the site, with UserRepository, which has a GetUser (id, includePurchases) method.
Beta.UserRepository.GetUser () calls Alpha.GetUser () inside.
The Alpha team says Beta should have a test that validates this special rule.
I did not agree, because if you have a unit test that calls a service, this is an integration test.
They donβt want the beta test to call Alpha, but instead they need a test that mocks the Alpha.GetUser method to include something like "if (includePurchases) user.Purchases = new List ()".
With this βifβ, a test will be written on the spot that approves the user. Purchases are empty or independent of the includePurchases flag.
Does that make sense to you?
The testing they want should this be an Alpha unit test problem only?
It seems to me that I am writing a test that tests the assumption of how Alpha works.
source share