Just because a test fails it does not mean that the code is wrong.
I found a javascript ui test that was failing for changes that could not be caused by user input. The test api could introduce data in a manner that the ui does not permit. In this case the test was wrong.
In general a failing test can reveal:
– The code is wrong
– The test is wrong
– They are both wrong