← Back to team overview

yardbirds team mailing list archive

On Testing

 

I recently announced that lp:yardbird now boasts 86% test coverage:

	https://launchpad.net/yardbird/+announcement/4574

This is a little misleading, as I hint at toward the end, but I honestly
expected the number to be closer to 40.  I've just been adding tests to
give the Client and TestCase subclasses a fair shake, and to cover some
of the core IOTower behaviors.

So here's the coverage report again, showing only the modules that don't
show 100%:

Name                                           Stmts   Exec  Cover
	Missing
----------------------------------------------------------------------------
/tmp/yardbird/iotower/ircviews                   170    132    77%   
	22, 26-32, 39, 128, 134, 136, 145, 164, 167, 191, 209, 216-228, 233-249
/tmp/yardbird/iotower/models                      34     28    82%
	8-18, 34, 48-57
/tmp/yardbird/yardbird/irc                        34     25    73%   
	14, 25-31, 33, 44
/tmp/yardbird/yardbird/shortcuts                  20     16    80%   
	9, 21, 34, 37
/tmp/yardbird/yardbird/test/client                87     82    94%   
	50, 83, 136, 139, 142
/tmp/yardbird/yardbird/test/testcases             42     27    64%
	17-22, 28-33, 35, 37, 53
/tmp/yardbird/yardbird/utils/decorators           20     17    85%
	11-14
----------------------------------------------------------------------------
TOTAL                                            593    513    86%   

As you can see, our coverage of IOTower's views is lacking, and we could
stand to test the models a bit (I need to silence the 8-18 "GO GET YARDBIRD"
exception block in these reports, but the rest is just the __unicode__()
methods).

yardbird.irc and yardbird.utils.decorators are missing a chunk because
right now my tests don't cover all the combinations of channel
membership and addressing mode.

yardbird.shortcuts is a few isolated corner cases that aren't being
checked (largely because iotower is rather well-behaved in how it calls
these shortcuts).

Finally, test.client and test.testcases are showing features that I'm
not actually using here.  I'm not doing part, action, or topic, for
example: that shows up in test.client.  The two big blocks in
test.testcases are exception handlers for hitting ^C mid-test and such
so really they ought to be excluded from the coverage analysis.  

That leaves two stubs in test.testcases that I should assertRaises
somewhere, and I should make sure that the count= parameter to
assertContains works as expected.

Now this coverage metric isn't perfect.  It doesn't, for example, tell
us if our tests really represent how we want iotower to behave.  That
said, I think I'd like to move toward a policy where merges into
official branches must have 100% test coverage without abusing the
"pragma: no cover" comment hack, and all tests must pass.

-- 
"If you carefully examine the intercal package (which
was not available for a month despite emails about it
being a 404), you will discover that . is in ESR's
PATH."   -- Joey Hess



Follow ups