[LRUG] Joined-up unit tests

Denny 2024 at denny.me
Thu Jun 6 05:02:33 PDT 2024


On 2024-06-06 10:51, Patrick Gleeson wrote:
> I've been bitten by bad unit tests in the past (mostly ones I've 
> written myself),
> and lean towards integration tests (a la
> https://x.com/rauchg/status/807626710350839808) when given the choice. 
> But I want
> to believe good unit tests are achievable.
> ...
> Are there any good patterns for constraining the arguments and return 
> values stated
> in mocks somehow? I'd love it if something would check that the inputs 
> and outputs
> I specify when mocking service B have been "proven" to be accurate in 
> my unit tests
> for B. That way my unit tests could give me some of the benefits of 
> (slower,
> unwieldier) integration tests "for free". Or am I being hopelessly 
> naive and
> misguided here?

I've generally seen this approximated by having comprehensive unit tests 
(with the weaknesses you've described) complemented by a smaller set of 
'golden path' integration tests intended to catch most of the sorts of 
issue you're asking about here.


More information about the Chat mailing list