Always interesting to hear different points of view on this subject. Personally I think mocks make sense to capture complex sets of interactions or otherwise difficult to reach error conditions, so I don’t think it’s a do or do-not kind of thing.

  • JackbyDev@programming.dev
    link
    fedilink
    English
    arrow-up
    5
    ·
    1 year ago

    I’m a Java guy so not sure how different it is. It bothers me when people make such absolute statements like “don’t use mocking” and then give examples like this,

    What happens in dep1 gets a new function Add and you change your code to use it? You break your test, even though no behavior in your code has changed. We shouldn’t be rewriting tests that have the exact same inputs and expected outputs.

    What the heck do they mean no behavior in my code changed? They just said in the previous sentence that I changed my code. There are some better arguments but that one is weak.