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

Add a coverage check mojo #6

Closed
marchof opened this issue Aug 27, 2012 · 12 comments
Closed

Add a coverage check mojo #6

marchof opened this issue Aug 27, 2012 · 12 comments

Comments

@marchof
Copy link
Member

marchof commented Aug 27, 2012

timothyastle@SF

It would be nice if the JaCoCo Maven Plugin supported a mojo that would check the coverage and fail the build if the coverage was not met.

This was a nice feature in the Maven Cobetura plugin (http://mojo.codehaus.org/cobertura-maven-plugin/usage.html) and it helped developers know if their commit would drop the code coverage before actually committing.

Currently developers have to lean on sonar (external system) to see if their commit will break the build if build breaks are enabled.

@vmassol
Copy link

vmassol commented Sep 5, 2012

I'd really love this too. We currently use Clover for this but would like to change to Jacoco and this is holding us.

Thanks for a great tool.

klieber added a commit to klieber/jacoco that referenced this issue Sep 17, 2012
added a coverage check mojo which attaches to the verify phase by default, closes issue jacoco#6
@wakaleo
Copy link

wakaleo commented Sep 27, 2012

This feature would make JaCoCo a compelling solution for Continuous Delivery, as it would allow 1) the build pipeline to break if there isn't enough coverage, and 2) since the on-the-fly coverage is fast and doesn't affect the generated JAR files, code coverage can be integrated into the normal test phases, which means you don't need to rerun the tests for code coverage. In sum, a killer feature for Continuous Delivery.

@marchof
Copy link
Member Author

marchof commented Sep 27, 2012

Wakaleo, do you have an idea how to specify "enough coverage"? Percentage of what metric? Is the limit for the overall project, per package or per class?

Thx,
-marc

@wakaleo
Copy link

wakaleo commented Sep 27, 2012

Ideally, you would want to be able to set minimum values of percentage
instruction and branch coverage overall, per package and per class, as you
can have different constraints at different levels.

Here is how the Maven Cobertura Plugin does things:
http://mojo.codehaus.org/cobertura-maven-plugin/usage.html#Check

Cheers

  • John.

On 28 September 2012 00:52, Marc R. Hoffmann notifications@github.comwrote:

Wakaleo, do you have an idea how to specify "enough coverage"? Percentage
of what metric? Is the limit for the overall project, per package or per
class?

Thx,
-marc


Reply to this email directly or view it on GitHubhttps://github.com//issues/6#issuecomment-8938644.


John Smart | Wakaleo Consulting | +61 407 247 642
Optimizing your software development process
http://www.wakaleo.com | john.smart@wakaleo.com

@klieber
Copy link
Contributor

klieber commented Sep 28, 2012

The 'check' goal I've added with Pull Request #26 gives you a configuration similar to the cobertura plugin except it doesn't have the regex functionality. I'm sure that could be added later on.

You can see an example configuration here:
https://github.com/klieber/jacoco/blob/master/jacoco-maven-plugin.test/it/it-check-passes/pom.xml

In this example the check requires 100% coverage of everything.

@wakaleo
Copy link

wakaleo commented Sep 28, 2012

That would do fine (the regex is more advanced, so could wait til later
on). Is there an ETO for the next release?

On 29 September 2012 08:04, Kyle Lieber notifications@github.com wrote:

The 'check' goal I've added with Pull Request #26https://github.com/jacoco/jacoco/issues/26gives you a configuration similar to the cobertura plugin except it doesn't
have the regex functionality. I'm sure that could be added later on.

You can see an example configuration here:

https://github.com/klieber/jacoco/blob/master/jacoco-maven-plugin.test/it/it-check-passes/pom.xml

In this example the check requires that 100% coverage of everything.


Reply to this email directly or view it on GitHubhttps://github.com//issues/6#issuecomment-8996729.


John Smart | Wakaleo Consulting | +61 407 247 642
Optimizing your software development process
http://www.wakaleo.com | john.smart@wakaleo.com

@djgraff209
Copy link

We just got sandbagged by Java 7 and cobertura - hate to be a pest but is there a release pending or alternatively is there a repo containing 0.6.1-SNAPSHOT including this?

@klieber
Copy link
Contributor

klieber commented Oct 11, 2012

I haven't heard anything on whether or not the JaCoCo developers plan to merge it in or not. Based on this discussion from their mailing list, it looks like they haven't decided if they like the implementation or not.

@djgraff209
Copy link

Thanks for the response

@Godin
Copy link
Member

Godin commented Oct 12, 2012

For sure we plan to provide such functionality. Just be patient ;)

@djgraff209
Copy link

@Godin - Of course :-) I know this is all volunteer and I appreciate greatly all the hard work that is being put towards this. To date it looks like there is a release ~ every 30 days. That works out fine and I can wait. I just have to get my people to be proactive with their coverage reports.

@semmons-okta
Copy link

Another vote for this. I'm in the process of converting our coverage over from cobertura and this is one remaining thing - as our ci process uses code coverage as one of it's gating factors for a "successful" build. Thanks!

Godin added a commit that referenced this issue Nov 10, 2012
GitHub #6: Add a coverage check mojo
Godin added a commit that referenced this issue Nov 10, 2012
@Godin Godin closed this as completed Nov 10, 2012
Godin added a commit that referenced this issue Nov 22, 2012
@jacoco jacoco locked and limited conversation to collaborators Jan 11, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants