On the other hand, frivolous tests aren't bad. They will break at the slightest refactor, but then the AI doing the refactoring will have to confront that fact and maybe improve the tests.
Frivolous tests can be bad, when they give you a false sense of confidence.
I had a kid a couple months ago submit a MR with tests included in the code and the tests were just nonsense. It was doing stuff like "create a native datastructure (Python dict), pass the datastructure as an arg to a function that just reads it and doesn't mutate anything, and then check that the values in the datastructure are still what they were initially created as"; if that test ever fails, it's above your paygrade, because the language is broken. It's basically just doing x = 1; assert x == 1 and acting as if that'll catch anything.
Well, that test could check that the method that is supposed to not mutate the object doesn't mutate it, someone could try to change that method in the future so that it mutates the argument.
No, in the context it's nonsensical. More specifically, it's a GET request that's fired off against the backend, so nobody could possibly know or care if the arguments got mutated internally. The "test" was dumping the return from the GET request and instead checking that the args being sent were still the same after the call as they were before. It was just utter nonsense that showed a lack of understanding of how tests work and the nature of the system purportedly being tested.
The point of a good test suite is that you know if you broke some functionality during a refactor. If you have to rewrite the tests, there's no guarantee the new test suite will have the same coverage.
Well, yes, but overtesting in that case isn't a problem. If your tests too closely parallel the code, they will be more brittle, but it doesn't introduce the chance to break functionality via a new edge case
View all comments
Show parent comment
5
u/10art1 Oct 20 '26
On the other hand, frivolous tests aren't bad. They will break at the slightest refactor, but then the AI doing the refactoring will have to confront that fact and maybe improve the tests.