This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 262704 - [releng] measure test coverage for builds
Summary: [releng] measure test coverage for builds
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Mylyn (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 3.7   Edit
Assignee: Steffen Pingel CLA
QA Contact:
URL: http://wiki.eclipse.org/index.php/Cod...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-01-27 21:05 EST by Steffen Pingel CLA
Modified: 2012-01-26 13:00 EST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Steffen Pingel CLA 2009-01-27 21:05:09 EST
We should measure code coverage as part of running tests during continuous build. Instructions can be found on bug 154159 and on the Eclipse wiki:

http://wiki.eclipse.org/index.php/Code_Coverage_with_Emma
Comment 1 Steffen Pingel CLA 2010-01-13 04:58:40 EST
Turns out that measuring of test coverage is fairly straight forward to integrate with the current build using cobertura (http://cobertura.sourceforge.net/). Is there any interest in generating code coverage report as part of test execution?

I am in the process of setting up a hudson instance at http://mylyn.eclipse.org/hudson/ which would make the results accessible to everyone. If the server has sufficient resources tests would run on every commit or nightly otherwise.
Comment 2 David Green CLA 2010-01-13 20:45:51 EST
I've done this with cobertura.  The classes under test must be instrumented, and the instrumented classes must have their classpath augmented with the cobertura runtime.  To do this I had the ant build alter the bundles under test: extract and instrument their classes, and alter the manifest to include a cobertura bundle.  I hope that there's a better way, since what I did was non-trivial and adds significantly to the build time.
Comment 3 Steffen Pingel CLA 2010-01-13 23:40:05 EST
I simply instrument jars after extracting them to the dropins folder and then add cobertura to the boot class path of the JVM that launches the Eclipse instance running tests. The overhead seems minimal, 10% at most.
Comment 4 David Green CLA 2010-01-14 13:35:06 EST
See sample "coverage report from Textile-J":https://textile-j.dev.java.net/builds/net.java.textilej/2.2.864/coverage/frame-summary.html
Comment 5 David Green CLA 2010-01-14 13:37:50 EST
+1, it's nice to have code coverage.  That said, see this related article "Code coverage tools can be misleading":http://greensopinion.blogspot.com/2008/05/code-coverage-tools-can-be-misleading.html
Comment 6 Steffen Pingel CLA 2010-01-14 14:42:17 EST
That's a great post. I very much agree with the point that measuring code coverage can be used as a tool to find code that wasn't executed but it's difficult to read other results out of the reports.

As discussed on the call I'll go ahead and setup build and test plans on the mylyn.eclipse.org hudson in the next couple of weeks. Coverage reports will be accessible from the build server and may either run nightly or more regularly depending on the additional overhead imposed by measuring  test coverage.
Comment 9 Benjamin Muskalla CLA 2011-06-03 04:38:04 EDT
We could also think about using JaCoCo (follow up of EclEmma), Platform is already doing this with JaCoCo and it's IP approved.

* http://eclemma.org/jacoco/index.html
* http://wiki.eclipse.org/JaCoCo/Proposal
* http://relengofthenerds.blogspot.com/2011/03/sdk-code-coverage-with-jacoco.html
Comment 10 Steffen Pingel CLA 2012-01-26 13:00:12 EST
I added support for JaCoCo to the parent pom. To meassure test coverage -Dcoverage.skip=false needs to be specified. Coverage and other quality reports are published to http://mylyn.org/sonar/. This is currently configured for Mylyn Builds and Mylyn Docs but I plan on adding additional builds in the next few days.