Ridiculously low unit test coverage
@oggis
Submitted by Olli Salli Assigned to Andre Magalhaes @andrunko
Description
The make lcov-check target in tp-qt4 was apparently broken for a long time. I fixed it a few days ago only to find that currently, the test coverage is sorry at best, which can be seen at the summary page in the URL.
At the time of writing, the line coverage for tp-qt4 git master is 64.9% and the branch coverage is 43.1%. Out of the 50 source files only 18 have line coverage above 75% and only 6 of them have above 90%, of which 2 are trivial. Function coverage is even more sorry - although it would be easiest to keep at a good level, it's only 54.9% overall and under 50% for 20 source files.
Thus, we're not exactly on solid ground with respect to detecting regressions, and might have a lot of sleeper bugs in the never-been-tested library code (fixed a few already while using previously unused API to combat race conditions in tests).
As a first step, we should target at least the "yellow" 75% line coverage for all individual source files, and as a long term target preferably keep as many of them as possible over the "green" 90% threshold.
Some parts of the code are quite hard to test though - for example the file transfers. However, basic tests stressing its constructors and accessors etc in a basic way would be good to have even if we can't actually easily test actually transferring files.
It should be noted that branch coverage can't be very high unless we introduce a number of extremely redundant test cases to hit sanity check branches - this doesn't have much effect on line coverage though as the sanity check then blocks are mostly one-liners.
Version: git master