3

I know unit tests and TDD get a bad wrap but I think they’re both great. The problem is people don’t think about what they’re actually coding.

Today I uncovered a unit test with 100 asserts in it.
And half of them are in a loop.

😳

If unit tests weren’t a thing then the dev who wrote this would still be a shit dev.

Comments
  • 0
    "The problem is people don’t think about what they’re actually coding. "

    Really?
  • 0
    @spongegeoff well I suppose the problem is people
  • 0
    Unit and integration tests (automated tests really) don't have a bad rep as far as I know.

    I think TDD has a place. Personally I don't like it. I like an approach where I can write first (and I always write testable code or rework it after it works) and than have an automated test be the first consumer.

    There are occasions where I do write the tests first. That is usually when the API (internal not REST) is already highly specifically defined.
  • 0
    I like the shu-ha-ri principle here:

    First, do TDD 100% to the dot, learn how to write testable code, do not take shortcuts

    Then, start experimenting, try to apply it how you see fit

    Last, make your own rules, having learned how to do it your way
Add Comment