Documented unittests & code coverage

Seb via Digitalmars-d digitalmars-d at puremagic.com
Sat Jul 30 14:42:25 PDT 2016


On Friday, 29 July 2016 at 05:49:01 UTC, Jonathan M Davis wrote:
> On Thursday, July 28, 2016 22:12:58 Walter Bright via 
> Digitalmars-d wrote:
>> As soon as we start taking the % coverage too seriously, we 
>> are in trouble. It's never going to be cut and dried what 
>> should be tested and what is unreasonable to test, and I see 
>> no point in arguing about it.
>>
>> The % is a useful indicator, that is all. It is not a 
>> substitute for thought.
>>
>> As always, use good judgement.
>
> True, but particularly when you start doing stuff like trying 
> to require that modules have 100% coverage - or that the 
> coverage not be reduced by a change - it starts mattering - 
> especially if it's done with build tools. The current situation 
> is far from the end of the world, but I definitely think that 
> we'd be better off if we fixed some of these issues so that the 
> percentage reflected the amount of the actual code that's 
> covered rather than having unit tests, assert(0) statements, 
> invariants, etc. start affecting code coverage when they aren't 
> what you're trying to cover at all.
>
> - Jonathan M Davis

Yep especially because I think we agree that "coverage [should] 
not be reduced by a change", except there is a pretty good reason 
to do so?

It could have the negative effect that people won't use such 
techniques anymore (e.g. debugging in unittests, invariants, ...) 
as they might develop an evil smell.


More information about the Digitalmars-d mailing list