Hacker News new | ask | show | jobs
by bashtoni 21 days ago
Sure. If his take was "100% unit test coverage is a waste of time" I think that's not unreasonable. You could make a case that the "you must write tests before you write code, every single time!" stuff is needlessly dogmatic. I also think that sometimes people focus too much on unit tests to the detriment of end to end tests that better model actual system interactions.

None of these were Theo's take. He was pushing the idea that unit tests in general were a waste of time because you could be shipping new features instead.

https://www.youtube.com/watch?v=pvBHyip4peo for an example of this. The nicest possible interpretation on this is that he's deliberately saying something he knows is wrong to attract attention.

2 comments

Tests before code makes sense when fixing bugs. Red-green specifically.

1: get bug

2: write tests that should work, but don’t because of bug

3: fix bug

4: confirm fix by running tests

Makes things a LOT easier for people checking the PR, they can just confirm the tests are correct pretty much.

As a bonus the same bug can’t surface again.

Yep, I'm in full agreement. When extending functionality of some already existing code it also generally makes sense to write tests first.

I think the value is much lower (maybe even negative) when you're still trying to work out what shape the code will take, in an initial implementation.

Of course, as others have pointed out, nuanced opinion doesn't get clicks or YouTube views.

Oh I do that naturally as my rational problem investigation. Sometimes you can’t write a test for that, you need to test it yourself
He doesn't believe that unit tests are complete waste of time. Just a relative waste of time. He doesn't mind AI agents writing tests. It's just mostly waste of time for humans. Because the value you get for them is not worth developer time in most cases. It's worth agent time.