| > Its essentially the same thing with just different sytnax. Indeed. Hence why I said that they can both be considered stubs (or whatever you want to call them). We already went over this. But one comes without all the devastating baggage of mockery, which is a pretty big deal. > The nice thing about these mocker libraries is they integrate with the testing framework to show nicely formatted error messages about what exactly went wrong Except you also need all of that same information when the same thing happens in production – for your logs, the end user, or even plain functionality – so you haven't gained anything. You're just duplicating efforts for no reason. That or, knowing the average programmer, they'll just haphazardly throw in that information and not test it since they think mockery gives them the information anyway, and then the future programmer won't be able to figure out when it does some particular thing, which would have been avoided if properly documented in test. Indeed, programmers by and large seem to hate other programmers for some reason. That doesn't seem like a good justification, though. > Essentially if you take your concept further and try build a general purpose library for building out those stub functions you'll get something that looks like the mock library. It may be that mockery is just a poor implementation of the concept. There are some obvious improvements that could be made to mockery to at least begin to help with its grievous problems, so we know it is not as good as it could be. Is there a tool that does it better? Or is this a classic case of someone taking DRY much too literally? As the Go proverb goes: A little copying is better than a little dependency. Is an abstraction truly warranted in the first place? |