378
74
It seems reasonable to me that if a serious bug is found in production by end-users, a failing unit test should be added to cover that bug, thus intentionally breaking the build until the bug is fixed. My rationale for this is that the build should have been failing all along, but wasn't due to inadequate automated test coverage.
Several of my colleagues have disagreed saying that a failing unit test shouldn't be checked in. I agree with this viewpoint in terms of normal TDD practices, but I think that production bugs should be handled differently - after all why would you want to allow a build to succeed with known defects?
Does anyone else have proven strategies for handling this scenario? I understand intentionally breaking the build could be disruptive to other team members, but that entirely depends on how you're using branches.
66+1; a very provocative question. I can see both sides. – Carl Manaster – 2012-01-20T11:46:30.647
26You use the term "the build" to include "the tests", which is not a universal understanding. – Jay Bazuzi – 2012-01-20T21:19:13.157
16If your doing TDD you would write the failing test, then fix the code and then check-in. Thus you avoid a broken build. – dietbuddha – 2012-01-22T04:22:06.493
6By the same logic you should shut down the clients' live instances until you fix the problem. No, you shouldn't break the build. Let the developer handling the bug add the unit test and the code changes together. No need to shut the whole proccess down. – Thanos Papathanasiou – 2012-01-25T13:42:30.530