• jokro@feddit.org
    link
    fedilink
    arrow-up
    17
    ·
    5 days ago

    There is also this gem in the post:

    You shouldn’t be mocking your methods, you should mock your IO. And, similarly, you shouldn’t test methods, but rather software functionality

    I totally agree! With containers you might not even have to mock your IO but can check if the application behaves correctly.

    • thingsiplay@lemmy.ml
      link
      fedilink
      arrow-up
      16
      ·
      5 days ago

      Unit and method tests are still useful to quickly find where the issue occured. If you just test the input and output of the program, no its individual units, then in an error case you still need to figure out where it exactly went wrong. So in short, its not just to check if program behaves correctly, unit tests also helps debugging.

      • jokro@feddit.org
        link
        fedilink
        arrow-up
        2
        ·
        2 days ago

        I agree if it’s checking if a method gives the right output for a specific input. But i’m more concernd with checking if it issued the right side effects, i.e. called right services and so on and then checking if it made right calls to the mocks.

    • FizzyOrange@programming.dev
      link
      fedilink
      arrow-up
      1
      arrow-down
      1
      ·
      4 days ago

      I work in silicon verification where we do extremely thorough testing, and that is nonsense. It’s perfectly fine to test internals of a system because often it is difficult or impossible to get good test coverage of internal parts of a system just using the public interface.