Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--branch option not reported in cobertura #65

Closed
nedbat opened this issue May 10, 2010 · 8 comments
Closed

--branch option not reported in cobertura #65

nedbat opened this issue May 10, 2010 · 8 comments
Labels
bug Something isn't working

Comments

@nedbat
Copy link
Owner

nedbat commented May 10, 2010

Originally reported by djcoin (Bitbucket: djcoin, GitHub: djcoin)


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.


@nedbat
Copy link
Owner Author

nedbat commented May 10, 2010

Can you provide me with version information for Hudson and the cobertura plugin?

@nedbat
Copy link
Owner Author

nedbat commented May 14, 2010

Original comment by djcoin (Bitbucket: djcoin, GitHub: djcoin)


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

@nedbat
Copy link
Owner Author

nedbat commented May 27, 2010

Original comment by zorgzorg2 (Bitbucket: zorgzorg2, GitHub: Unknown)


Hi,

I can confirm the bug, with hudson 1.359 and cobertura plugin 0.8.11.

Martin

@nedbat
Copy link
Owner Author

nedbat commented May 27, 2010

Original comment by Devin Bayer (Bitbucket: akvadrako, GitHub: akvadrako)


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.

@nedbat
Copy link
Owner Author

nedbat commented May 27, 2010

Original comment by Anonymous


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

@nedbat
Copy link
Owner Author

nedbat commented Sep 4, 2010

Also see issue #81 with some more details.

@nedbat
Copy link
Owner Author

nedbat commented Sep 4, 2010

Issue #81 was marked as a duplicate of this issue.

@nedbat
Copy link
Owner Author

nedbat commented Sep 4, 2010

Fixed in <<changeset b1911a191a3b (bb)>>.

@nedbat nedbat closed this as completed Sep 27, 2010
@nedbat nedbat added major bug Something isn't working labels Jun 23, 2018
agronholm added a commit to agronholm/coveragepy that referenced this issue Aug 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant