• dan@upvote.au
      link
      fedilink
      arrow-up
      0
      ·
      11 months ago

      I’ve written some tests that got complex enough that I also wrote tests for the logic within the tests.

      • AAA@feddit.de
        link
        fedilink
        arrow-up
        0
        ·
        11 months ago

        We do that for some of the more complex business logic. We wrote libraries, which are used by our tests, and we wrote tests which test the library functions to ensure they provide correct results.

        What always worries me is that WE came up with that. It wasn’t some higher up, or business unit, or anything. Only because we cared to do our job correctly. If we didn’t - nobody would. Nobody is watching the testers (in my experience).

  • SrTobi@feddit.de
    link
    fedilink
    arrow-up
    0
    ·
    11 months ago

    And then in the end we realize the most important thing was the tests we wrote along the way.

  • Alexc@lemmings.world
    link
    fedilink
    arrow-up
    0
    ·
    11 months ago

    This is why you write the test before the code. You write the test to make sure something fails, then you write the code to make it pass. Then you repeat this until all your behaviors are captured in code. It’s called TDD

    But, full marks for writing tests in the first place

    • oce 🐆@jlai.lu
      link
      fedilink
      arrow-up
      0
      ·
      11 months ago

      That supposes to have a clear idea of what you’re going to code. Otherwise, it’s a lot of time wasted to constantly rewrite both the code and tests as you better understand how you’re going to solve the task while trying. I guess it works for very narrowed tasks rather than opened problems.

      • homoludens@feddit.de
        link
        fedilink
        arrow-up
        0
        ·
        edit-2
        11 months ago

        constantly rewrite both the code and tests as you better understand how you’re going to solve the task while trying

        The tests should be decoupled from the “how” though. It’s obviously not possible to completely decouple them, but if you’re “constantly” rewriting, something is going wrong.

        Brilliant talk on that topic (with slight audio problems): https://www.youtube.com/watch?v=EZ05e7EMOLM