|
|
|
|
|
by jononor
3441 days ago
|
|
Many unit tests are just written to test code, which is at best irrelevant. At worst your codebase is 2-3x bigger and more abstract than it needs to, where useless tests keep code alive and useless code keeps tests alive.
Test functionality, as close to the promises given to outside consumers as is feasible. Be it API or UI for other people/projects/services.
This is the stuff that needs to work (and thus often need to be stable). No-one cares whether a function deep down inside the code, used a part of the implementation of promised functionality works. Delete it if you can. Only case where I'd support "unit tests" as typically practiced (small units, isolated functions/classes) is around core competence (defined as narrowly as possible). But then I'd argue that this functionality should be put into a library anyways, which is used by products codebases. And then the tests are tests for the functionality promised to the products. |
|
I guess I shouldn't have used the word 'brittle', but this is what I was thinking of.
And of course, I think unit testing anything and everything is absurd and not a good use of developer time.