1. Ned Batchelder
  2. coverage.py
  3. Issues
Issue #65 resolved

--branch option not reported in cobertura

djcoin
created an issue

It seems the --branch option does not behave properly with cobertura. It keeps saying 0 % for conditionnals. A quick look in the coverage.xml seems to have thos figures in. So maybe the Cobertura format has been updated, and is not correct now.

This has been stated using Hudson and the cobertura plugin.

Comments (8)

  1. djcoin reporter

    Sorry, i fill this issue much too quickly, here are some details:

    Hudson ver. 1.352 Hudson Cobertura plugin: 0.8.11

    A relevant screenshot showing the issue and the coverage.xml file (that seems right!) generated are attached.

    Here you can see one conditional is properly tested and the other is not, we should then get 50 % coverage on conditionals, yet, it sticks to 0 percent, whatever test you may submit.

    Weirder, if you go one dir up, you can see that conditional are not detected (N/A), whereas they are set to 0 when browsing the right file.

    Thanks,

    Simon Thépot

  2. Devin Bayer
    • changed component to xml
    • changed version to 3.3

    It looks like the issue is CoberturaCoverageParser.java requires some more attributes:

    196	            if (Boolean.parseBoolean(attributes.getValue("branch"))) {
    197	                final String conditionCoverage = attributes.getValue("condition-coverage");
    198	                if (conditionCoverage != null) {
    199	                    // some cases in the wild have branch = true but no condition-coverage attribute
    201	                    // should be of the format xxx% (yyy/zzz)
    202	                    Matcher matcher = Pattern.compile("(\\d*)\\%\\s*\\((\\d*)/(\\d*)\\)").matcher(conditionCoverage);
    

    otherwise is just ignores the branch tag.

  3. Anonymous

    Thanks for taking into account account my comments. Do you guys know if this issue is available for newer version of Hudson ?

  4. Log in to comment