2

We do coverage reports with the famous and possible the only solution in python world i.e. coverage.py

Now, What we acheive with coverage.py is this : enter image description here

Where as what we could achieve with ruby-rails is : enter image description here

So, my question is how do you get more detailed coverage reports with coverage.py ?

[ Or any other tool in the python django world ]

Note:

  • coverage run manage.py test --settings=project.test_settings
  • Generate the report by coverage html
  • Should / Can I pass in extra parameters to coverage while generating report ?
10
  • Did you see github.com/relevance/rcov Commented Oct 13, 2012 at 7:14
  • Can you suggest something similar in the Python world ? Commented Oct 13, 2012 at 7:50
  • Sorry, i misread. Don't know much of python Commented Oct 13, 2012 at 10:27
  • jenkins + django-jenkins works for us. Commented Oct 13, 2012 at 21:49
  • 1
    @YugalJindle: I'm very interested in adding features to coverage.py, but I don't see what you are asking for. You describe the Rails report as "more detailed," but it looks like it has all the same information as the Python report? I see hits/line, but I don't understand how that is helpful? Commented Oct 14, 2012 at 1:06

1 Answer 1

2

1) A search box seems useful, no one has ever suggested it before!

2) Conditional coverage: coverage.py has a --branch switch that enables branch coverage, is this what you are looking for?

3) Hits/line: is this how many times each line was executed? I've never seen it aggregated like this. I don't understand how I would use that statistic in my own work. Can you help me understand why people want to know the averaged hits/line?

Sign up to request clarification or add additional context in comments.

7 Comments

So, (1) You already agree. (2) There can be more then 1 condition to follow a path. This creates the difference when we say code coverage doesn't ensures no bug. If we have a test for all conditions on a pivot its high-quality. [ http://en.wikipedia.org/wiki/Code_coverage#Modified_condition.2Fdecision_coverage ] And then lastly (3) this is more of an aggregation like average, higher hits/line the more rigorously code is tested. Lets imaging saying 5 hits/line on a 500 line of code. In that we are saying every line is executed 5 times on an average and all tests pass.
Right now we have only coverage percentage - I can cover all the code by True and False. Whereas if a condition is affected by n variables, then there are n ways the code has to behave. That motivation gets lost since we already have 100% coverage and that is all coverage.py gives us.
You can go through the tool used in ruby-rails - from which I have quoted the image in the question.
@YugalJindle: it's true, coverage.py doesn't provide MCDC measurements. I don't know how to implement MCDC. :( As far as I know, the rcov doesn't implement it either, in fact, it doesn't even seem to support branch coverage.
@YugalJindle: I generally add features to coverage.py when I get a sense that a number of people want them. Thanks for letting me know what you'd like, I'll take that into account in the future.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.