• @[email protected]
    link
    fedilink
    English
    920 days ago

    Apparently no-one wants to write unit tests, but I enjoy it, do it well, and even find it relaxing.

    I’m always confused by my peer’s reluctance and grumbling thereabout, and horrified to see the incomprehensible mess of (often useless) tests they produce in the end.

    • @[email protected]
      link
      fedilink
      320 days ago

      Wish we had more like you in the industry. It’s a skill to write non-brittle non-trivial tests but surely it’s not actually as difficult as the results indicate?

      • @[email protected]
        link
        fedilink
        English
        319 days ago

        I think it rubs people the wrong way because (though it looks like code) in some sense it is not programming… it’s like the negative image of a program… like a mold or specification-box that contains and fits around the code, which reverses several key principles.

        It also can highlight if the code needs to be moved or reorganized, and let me tell you… the LAST thing that devs want is to interpret the struggle to write a unit test as a sign the code needs rework, they would MUCH rather keep unit tests as an after-thought; like some kind of mandated torture-ritual that produces a thing of no value.

        Speaking of not valuing tests… I’ve literally seen devs blithely invert test assertions (that where clearly valid), those that made sense in context, and even some that were PART OF THE TEST’S NAME… just to brush the “meaningless failures” out of their way… as if they could not be bothered to even read one sentence to understand the “why”… uggh.

        Anyway, I digress and ramble. If you really want more of me in the industry, I can provide one more! If you happen to know of any teams that need a professional-unit-testing-developer, I’m recently on the market! :)

        • @[email protected]
          link
          fedilink
          119 days ago

          Pre-merge code review should stop that kind of thing. I honestly haven’t seen anything like this in years.

          • @[email protected]
            link
            fedilink
            English
            119 days ago

            Many code-reviewers likewise devalue tests, giving only a cursory skim over the unit-test section of PRs, if they examine them at all, and sometimes code-review itself is devalued to the point of a rubber-stamp (e.g. “great, we need someone from team X to approve it too… doesn’t matter who, though…”).

            If I could tell you, you would be SHOCKED at how high-profile and recent this sordid project was; it’s literally in the news and discussed in my podcasts.

    • @[email protected]
      link
      fedilink
      218 days ago

      Do you have any high quality resources on testing you would mind sharing? I’m mostly a self taught programmer who loves TDD, because I’m shit at writing code.

      • @[email protected]
        link
        fedilink
        English
        2
        edit-2
        16 days ago

        I would whole-heartedly recommend Robert Martin’s clean coding lecture series. It may be many hours of your life, but it is free on youtube and well worth the time. I don’t exactly recall what he says about testing in his lectures, but it’s probably pretty close. If nothing else, it will teach you to critically consider programming structure in the abstract (instead of following formulae), and to write code with the intent for it to be read and maintained by humans.

        I think he also has a series that includes “structured programming” (like early return vs deep nesting), but was unable to find it last time I looked for it. I recall having a shocked epiphany when he (i THINK it was Martin) demonstrated the exact way to clean up a function, that started out ugly, and ended up being reduced to literally nothing (the function was removed).