While putting together one of my last posts one thought kept scrolling through my head. This was the idea that when you modify your code, you need to make sure your that the intent of your tests still are correct. I know this concept may seem trivial, but how many of us actually do this.
I think most testing practitioners will agree that simply because a test passes green it does not mean that the test is valid and that the code under test is validly tested. It would not be to hard to imagine a scenario where your tests still pass after you have made changes to the code/class under test, but because your tests still run green you think you are in the clear.
Now I know you what you are thinking. You are thinking that if I am changing my code I should be doing so via tests, and you are correct. But you may be only touching a single test, when multiple tests may be affected. So we need to just quickly verify all the other tests.
Developers (myself included) need to really get into the habit of verifying affected tests when they change code, regardless of the results of their tests. To be honest, I feel that writing quality tests is harder then writing quality code (more on this here).
Just my thoughts.
Till next time,
05-23-2008 9:57 AM