Even when I would reluctantly admit I need to have tests on place, I never understood, why one might want to put the check for the number of tests you want to run in pg_tap. What’s the point? You know how many tests you want to run, so the only thing you need is to count the executions :). And when the number does not match it means that you didn’t count them correctly;)
That’s what I was absolutely sure about… until last week. A week before that I’ve discovered that I’ve mapped one foreign table incorrectly. Or, may be, it got changed and I didn’t notice – I didn’t have proper tests!
Nevertheless, after I fixed the table structure… yes, you are right, a number of tests failed! and since ai’ve added a whole bunch of newly mapped columns (21 of them, to be precise), I had to place 84 more tests… four for each column… and after I did it… and pg_tap reported that I ran less tests than I’ve planned. And my first inclination was to change the “number of tests I want to run”. And I almost did it… but then I thought: I remember I’ve counted! If there are less than 84 new tests, then there are two options: either I counted them incorrectly, or – I misses several tests.
It was not fun at all, going through this huge file with all the tests… but I found the missing ones! And I was so happy again, that somebody forced me to run the tests each time I am committing changes 🙂