betabug... Sascha Welter

home english | home deutsch | Site Map | Sascha | Kontakt | Pro | Weblog | Wiki

11 March 2011

Test Coverage on Zope Tests

Hey, I discovered it's already there!

Sometimes I'm a bit late to the party: This morning I was thinking about checking how much of my code is really covered by my tests. So I searched the f* web for how to run python on Zope. Turns out it's already in there, ever since something like 2005. This is really one of the advantages of running a stable, mature platform like Zope.

What you need to do is to run zopectl test with the additional argument --coverage test_dir, e.g. I did:

./bin/zopectl test --coverage cov_test -k -m FinancialService

Then I found reports for every .py file in my FinancialService Product in the cov_test directory. The reports list how many times each line was run -- and they mark lines that weren't run at all. So far the test output is complaining about not giving coverage for functional.txt which is a file with functional doctest - this file consists of tests itself, I guess not testing it is ok. Since running the tests like this also takes much longer, I also had one test failing where a test on a timestamp failed.

Now I can fill the glaring holes in my test coverage. Sometimes I've missed a complete method, sometimes it's just a twisting turn in an if-clause. Testing fun, here I come!

Posted by betabug at 10:41 | Comments (0) | Trackbacks (0)
ch athens
Life in Athens (Greece) for a foreigner from the other side of the mountains. And with an interest in digital life and the feeling of change in a big city. Multilingual English - German - Greek.
Main blog page
Recent Entries
Best of
Some of the most sought after posts, judging from access logs and search engine queries.

Apple & Macintosh:
Security & Privacy:
Misc technical:
Athens for tourists and visitors:
Life in general:
<< Snowy Way Back | Main | square tokyo >>
There are no comments.
You can trackback to:
There are no trackbacks.