‹ BackHN Continuity

Thread

This Code Is CRAP (2011)

77 points · 57 comments · luispa

  1. almondfestival · · focus · HN ↗
    I'm sure this method has evolved and/or been supplanted over the last 15 years, but one thing that struck me reading this is how much the dynamics of unit test coverage have changed in recent history, with AI-generated commits containing 10x as many unit tests (many of them kind of silly and tautological) as in the olden days. Gonna need to update some of those coefficients in their CRAP1 formula... Or maybe test coverage has/will become too noisy a parameter to use at all.
    1. acedTrex · · focus · HN ↗
      > Or maybe test coverage has/will become too noisy a parameter to use at all.

      It already is, ive banned unit tests via ci checks from our codebases, they were not particularly useful before LLMs and now they are a net negative.

      We require int and some e2es and that does all that units do and more.

      1. agentultra · · focus · HN ↗
        Are they slow and brittle?

        I like having both. Unit tests are a decent indicator for local development. Fast, quick to iterate on. Integration tests are slow as molasses and I can’t iterate with them when it takes 20 minutes to setup the suite and run everything. Too slow. But still useful as you say.

        1. acedTrex · · focus · HN ↗
          They don't flake, generally can run a few hundred in 3-4 mins. Iteration times are definitely key.
      2. eternityforest · · focus · HN ↗
        I sometimes use unit tests to fill in gaps. I just caught a function with almost full coverage except for an if statement.

        Playwright e2e tests are harder to maintain than pytest code, so I wrote a test just for that one case, and while I was at it, a few other input strings that seemed like they could be problems.

        If the function had no test coverage at all, I probably would have tried to get it with an integration test, because that would mean the callers also weren't getting tested.

        1. acedTrex · · focus · HN ↗
          The occasional unit test is fine. But you do not need for example `test_helper_test.go` that is just ridiculous.

          Its gotten so bad I decided to throw the baby out with the bathwater so to speak and focus on the high value places instead of trying adjudicate every individual usage

Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.