Hacker News
points by bcvvvy 3 days ago | 0 comments
Test cases doesn't mean shit works. It means test cases pass.

About 50% of the test cases I've ever seen are pointless.

[–] teeray 2 days ago
IME, nobody reads the tests in code review either. They just see "looks like it has tests" *check*. Many times, I've caught LLMs writing completely vacuous tests for configurations of components that were impossible. But coverage number go up, so those tests get written.
[–] galaxyLogic 2 days ago
I've thought about this, tests should be easier to add to your modules. We dont' need a ton of tests, but we need them to be in more places.

Tests fix how the software can be changed and when software-spec evolves lots of tests can become obsolete. Maybe with AI it is easier to change the tests (?) which is good.

But there is another purpose for tests, besides "testing". It is to document your modules in a way that shows you how to use them, and let's you easily verify is this still working, can I trust it.

[–] mysterydip 2 days ago
I was reviewing some coordinate conversion code one time and a developer’s method of creating unit tests was to run their code, generate a result, then make that output the correct result for the test. Except the result was wrong based on other utilities doing the same conversion, and also failed edge cases.
[–] thargor90 2 days ago
For the inexperienced dev audience: generally speaking that is a valid way to generate regression tests and document novel edge case behavior.

In your case of course any existing utilities behavior/specs should be tested first, regression tests just on top, if they are not already covered.

[–] LtWorf 2 days ago
I've seen a coworker ship a test that contained a=1; assert a == 1.

Yes it was vibe coded. The "a" variable was never used, and was tested to be 1 several times.

It was several hundreds lines of course so I didn't bother reviewing the rest.

[–] bluGill 2 days ago
Test cases are an indicator. They say that this situation I thought of works as I think it should. It doesn't cover everything, but it does cover a large number of things.

A test is mostly useful only in the case that by failing it alerts you to a bug.

[–] eviks 2 days ago
They don't say that because you didn't write the tests, AI did, so who knows what behaviors it thought of and wrote tests for. That's the reason these type of metrics are very bad, especially in this context when bad tests are easier to write