On 13.08.2017 21:19, Peter Geoghegan wrote:
On Thu, Aug 10, 2017 at 2:53 PM, Thomas Munro
The current regression tests, isolation tests and TAP tests are very
good (though I admit my experience with TAP is limited), but IMHO we
are lacking support for C-level unit testing. Complicated, fiddly
things with many states, interactions, edge cases etc can be hard to
get full test coverage on from the outside. Consider
src/backend/utils/mmgr/freepage.c as a case in point.
It is my understanding that much of the benefit of unit testing comes
I never had this understanding. I write tests to test expected behavior
and not the coded one. If possible i separate the persons writing
unit-tests from the ones writing the function itself. Having someone
really read the documentation or translate the expectation into a
test-case, makes sure, the function itself works well.
Also it really safes time in the long run. Subtle changes / bugs can be
caught which unit-tests. Also a simple bug-report can be translated into
a unit-test make sure that the bugfix really works and that no
regression will happen later. I literally saved ones a week of work with
a single unit-test.
There are many other advantages, but to earn them the code need to be
written to be testable. And this is often not the case. Most literature
advises to Mocking, mixins or other techniques, which most times just
translate into "this code is not written testable" or "the technique /
language / concept / etc is not very good in being testable".
Sent via pgsql-hackers mailing list (email@example.com)
To make changes to your subscription: