• soloner@lemmy.world
    link
    fedilink
    arrow-up
    5
    ·
    edit-2
    11 months ago
    • TDD (red-green-refactor)
    • Dependency injection
    • Focusing/skipping tests
    • Minimize stubbing (only stub when you have to, and stub closest to the edge of the system)
    • Use rollback or other data cleanup strategy. Ensure tests don’t leave data leftovers.
    • Test the behavior, not the implementation. Don’t stub and spy so much that refractors to the source code with an equivalent implementation break the test or require extensive refractors to pass again.
    • Dunstabzugshaubitze@feddit.de
      link
      fedilink
      arrow-up
      3
      ·
      11 months ago

      But you will be glad for every non affected test, because the ensure nothing else breaks when you fulfil the whims of PM.

      I love having tests

      • FMT99@lemmy.world
        link
        fedilink
        arrow-up
        1
        arrow-down
        1
        ·
        11 months ago

        Except for those that are too coupled. Or those that pass because the response of the class you changed was stubbed in that other test.

        I love tests too by the way. Just many things I’m still not sure how to test properly. Always struggling with the borders between integration and isolation.