| || |
Unit testing bugs that no longer reproduce
Here is a common scenario on the project I work on: a bug is logges, then when verified at a later time, the scenario no longer reproduces. Or maybe it never really did, who knows. The question is, do we make a unit test for it to make sure it will not reproduce in the future? If yes, how do we check the test is correct, since the flow test fails - fix is added - test passes, does not apply bere?
Re: Unit testing bugs that no longer reproduce
Do you mean the scenario which the bug occurs no longer exists, or the bug just disappeared without an explicit fix checked in (was fixed by some other code change that no one knows about?)
In the former case you can't write a unit test. In the latter case, there's some room to write unit test. You can write a unit test using the inputs and expected results that originally produced the bug. You can try mutating the code to break the code for testing the unit test. Of course you still can't absolutely be sure the unit test will test for that exact bug. But it's still a nice to have if it doesn't take too much time to create. Can a piece of code be over tested?