News for hackers. Stuff that matters.
Re:Test Against Reality by bot314159 on Sunday July 09, 2023 @08:52AM (#36654092)
> you're not left with anything to test

Is this really that common? Maybe I'm out of touch, but I find it hard to imagine much code that just strings calls to dependencies together and has none of its own behaviour. Surely decisions are being made based on the dependencies behaviour? Isn't that worth unit testing?

Re:Test Against Reality by MoreQARespect on Sunday July 09, 2023 @09:29AM (#36654304)
Yes. Most CRUD apps are like this almost by definition.

It's more common for domain logic to be fairly simple and smeared across multiple systems and languages, though - e.g. some is in SQL, some is in a separate microservices, some is in module A and some is in module B and the bugs that are almost universally centered around the interactions between these systems rather than what the units do individually.

In either case unit tests end up being mimetic: assert derp == derp.

Re:Test Against Reality by watwut on Sunday July 09, 2023 @10:19AM (#36654636)
I worked with a lot of code like that. The decisions made on dependencies were trivial. Bugs happened when dependency answered with something we did not expected. Or when we send away wrong data (not knowing parameter X is mandatory when Y equals Z sort of thing).

Meanwhile, all those mocks were just clutter.

Integration tests made a whole lot of sense. Mocks did not.