Tests Are Not Specifications(paedubucher.ch) |
Tests Are Not Specifications(paedubucher.ch) |
Yes, in a technical sense they are tests. But they are bad tests precisely because they barely fulfill the purpose to clarify the behavior of the function.
I’m not convinced.
1. The actual specification is sometimes better reflected by the implementation than by some test cases. 2. Some test cases don't help you understanding what's supposed to be computed.
Of course, counterexamples could be made. Imagine a board game with a test function testing specific moves. Those test cases will help you understand the implementation a lot.
From the fact that there are some tests out there that are barely specifying anything, it does neither follow that tests are not supposed to be specifications nor that tests are not specifications in general.
I think these are important distinctions to make.
While it might be illuminating in some cases, it might be not helpful or either misleading in other cases.
It's like arguing that the main purpose of magazines is to lit a fire with them, because some of them are very flammable.
Tests are good to ensure that some property of the system that held true before still holds true after some modifications to the system has been made.