3 ms·
In my limited experience, tests should be written against a specification, not against code. Writing tests focused on code seems to often lead to tests that are
by ZenoArrow 11y ago
In my limited experience, tests should be written against a specification, not against code. Writing tests focused on code seems to often lead to tests that are too close to the implementation of the program, even with test-first approaches (you end up thinking about how you'll write the code when you're designing the tests).
By focusing on the specification, you can ensure that design decisions are made by the coder are fit for purpose.
I also think many tests would be better written as code contracts, you mainly want to ensure the inputs and outputs are valid, code contracts focus on this.