I have thoughts about the impact of assertion libraries in software
engineering. I came from a background where they are commonplace into
Go and in my earlier projects I used some the earlier iterations on
them (go-check).
While it's true that developers *can* use assertion libraries to
provide rich information about failures, in the vast majority of cases
they don't and this gets past review because without enrichment there
is just enough information to not be completely useless; you end up
with something along the lines of `assert.Equal(got, want)` which will
emit the line and a diff, but not any additional context, nor an
contextually relevant diff, while with a plain pkg/testing-based tests,
the author *must* include explicit context tailored for the setting to
get past any reasonable code review. The outcome then is weaker
information in the failing case and often more of it, so the work
needed to debug failures is compounded.
The other impact of assertion libraries is that they have gone to the
effort to compose a multitude of different tests from the small number
of language primitives that actually do the work of assessing a test's
success or failure which means that instead of needing to know just the
language, which I already do because I am writing code in it that is
being tested, I also need to know the assertion library's idioms and
quirks — often requiring digging several abstraction layers into the
assertion library — so there is a not insignificant additional
cognitive burden at the very time when cognitive burdens need to be
minimised (while debugging an issue).
Having seen both sides of approaches to testing, I am very glad that Go
does not promote the use of assertion libraries and I am sad that so
many people who write Go code have adopted them despite the project's
recommendation not to.