What is the value of checking in failing unit tests?
Posted
by
user20194
on Programmers
See other posts from Programmers
or by user20194
Published on 2011-03-15T15:01:20Z
Indexed on
2013/06/29
10:29 UTC
Read the original article
Hit count: 210
unit-testing
While there are ways of keeping unit tests from being executed, what is the value of checking in failing unit tests?
I will use a simple example: Case Sensitivity. The current code is case sensitive. A valid input into the method is "Cat" and it would return an enum of Animal.Cat. However, the desired functionality of the method should not be case sensitive. So if the method described was passed "cat" it could possibly return something like Animal.Null instead of Animal.Cat and the unit test would fail. Though a simple code change would make this work, a more complex issue may take weeks to fix, but identifying the bug with a unit test could be a less complex task.
The application currently being analyzed has 4 years of code that "works". However, recent discussions regarding unit tests have found flaws in the code. Some just need explicit implementation documentation (ex. case sensitive or not), or code that does not execute the bug based on how it is currently called. But unit tests can be created executing specific scenarios that will cause the bug to be seen and are valid inputs.
What is the value of checking in unit tests that exercise the bug until someone can get around to fixing the code?
Should this unit test be flagged with ignore, priority, category etc, to determine whether a build was successful based on tests executed? Eventually the unit test should be created to execute the code once someone fixes it.
On one hand it shows that identified bugs have not been fixed. On the other, there could be hundreds of failed unit tests showing up in the logs and weeding through the ones that should fail vs. failures due to a code check-in would be difficult to find.
© Programmers or respective owner