> Unit tests will often just mirror the behavior of the code. This is not useful.
Then they are characterisation tests, not unit tests. Which may or may not act at the unit level.
As for whether characterization tests are useful; they're extremely useful for, well, characterising existing code behaviour.
But they suck at detailing pre-code specification; that's what unit tests are for (at least at the unit level).
Now I'm not naive enough to believe most people adhere to this distinction appropriately. It's true that people sometimes treat X as Y in practice. But that's one thing, and a totally different thing to complain about X because people do Y instead.
Then they are characterisation tests, not unit tests. Which may or may not act at the unit level.
As for whether characterization tests are useful; they're extremely useful for, well, characterising existing code behaviour.
But they suck at detailing pre-code specification; that's what unit tests are for (at least at the unit level).
Now I'm not naive enough to believe most people adhere to this distinction appropriately. It's true that people sometimes treat X as Y in practice. But that's one thing, and a totally different thing to complain about X because people do Y instead.