I was at the TDD Workshop today and got my perspective adjusted on the matter of Unit Testing.
As I was trying to attack the method in my mind from different angles on my way back home, I came to the question of using Unit Tests on methods marked as Obsolete.
After all, Unit Tests are supposed to check that your code is all right whenever you run them. If your code uses Obsolete methods, this means that soon enough, it might not run and even not compile. Using nightly builds with unit tests will not reveal this matter, since using an Obsolete method raises only a faint warning.
Consider the following:
The Red Team is the infrastructure team for The Blue Team at Gulch inc.
The reds decide one day that they are going to refactor their code and decide to kick some methods out the door. Like every other polite team, they decide to keep the old methods, but place an ObsoleteAttribute on them.
The blues get the new set of assemblies and run all of their unit tests on them to see that their code is still all right. It is, since the Obsolete methods still run, but it’s not okay to use them.
I think that if the unit tests would warn in a way (or even fail), that the code uses an Obsolete method, nightmares like the ones Raymond has would just not occur (yes, only for people who use Unit Tests, you cynics ;).
What do you say?