Let's say your company sells software that comes with customizable text, and your team's job is to customize it. The client engagement includes a contract in which the client specifies all of the text resources and where your team guarantees a complete test cycle.
Somewhere in the code there is logic that looks like this:
var response = proxy.Foo(request);
if (!response.IsOK)
{
switch (response.ErrorCode)
{
case Constants.BadProfile:
DisplayError(Resources.BadProfile);
break;
case Constants.BadRequest:
DisplayError(Resources.BadRequest);
break;
default:
DisplayError(Resources.GeneralError); //Should never happen
break;
}
}
Based on the way the code is written, it is literally impossible to generate a data condition resulting in the third error. But the engineering team put it there just in case of a future code flaw or to guard against the situation where the client is out of date and the proxy throws a new and unfamiliar error.
That being said, the client has customized all three error message resources and QA wants to test all three of them.
Would it be reasonable for QA to insist on testing to ensure the general error resource is correct? How can they possibly produce that error?
Or is inclusion of the error message a mistake in the requirements, since it specifies a feature with no definable acceptance criteria?
Note: proxy
in this example is a third party service, so it is not possible to rig it to throw an unexpected error. We could of course modify the client code to force the error, but then we would not be testing the code base that will end up in production.
Edit:
The "proxy" in this case isn't a WCF or REST client. It is a black box binary DLL. There is no separation of concerns, no dependency injection, and no convenient transport to intercept. There is nowhere to shim the result without effort so heroic it would undermine the credibility of the test and the expenditure of effort for such an edge case.
On the other hand, flat out removal of the backstop just to hit a QA 100% stat seems a bit Dystopian, i.e. contrary to common sense.
We could just "hide" the feature and not tell the customer about it, but the text contains valuable support information that is specific to each customer.
proxy
is a third party service, can you replace it by some mock service, maybe by configuration? That would be a seem for testing. If not, I think "mistake in the requirements" describes it well.Constants
has only these two values? Then maybe the question should be titled "How do I test unreachable code?"