EclEmma 3.1.9 | Java Code Coverage for Eclipse | |
EclEmma 2.0 Position PaperThe EclEmma code coverage plug-in for Eclipse originally was designed as a wrapper for the EMMA code coverage library to make EMMA available within the Eclipse IDE. Since its initial release in 2006 EclEmma became a popular addition to the Eclipse Java IDE. As EMMA maintenance has stopped some years ago and we wanted to see functional enhancements like branch coverage for EclEmma we started a completely new code coverage backend called JaCoCo under the umbrella of the EclEmma project. The purpose of this paper is to setup expectations for the EclEmma/JaCoCo user community and serve as a guide line for technical decisions. The first release fully backed by JaCoCo is "EclEmma 2.0". Marc R. Hoffmann, Mountainminds GmbH & Co. KG, September 2011 (updated) Starting Point and MaximsSince its initial release in 2006 EclEmma became one of the most widely uses code coverage tool in the Java developer's tool box and is one of the most installed Eclipse plug-ins. As EMMA development has stopped shortly after the first EclEmma release in 2006 we started working on an alternative called JaCoCo in 2009. The aim of the JaCoCo Project is providing a lightweight, flexible and well documented library for integration with various build and development tools, see this mission statement for details. In the meantime JaCoCo is fully functional and has been adopted by several projects. For example the Eclipse platform integration builds are analyzed using the JaCoCo Ant tasks. Many open source as well as commercial projects use the JaCoCo plug-in for Sonar to control test quality. As EclEmma was originally developed to provide code coverage analysis directly for the individual developer, the same now applies for JaCoCo. A consistent view to test coverage metrics in the automated builds as well as the local Eclipse IDE requires a JaCoCo plug-in for Eclipse. From the EclEmma project's point of view there are at least the following three paths towards a JaCoCo integration for Eclipse:
I propose to follow option 3, which means migrate the existing EclEmma project towards JaCoCo. Given the high exposure of EclEmma this options offers a set of benefits:
The other two options appear less attractive due to two main aspects: The first point is the EMMA library itself. Given the issues described before and the fact that EMMA fails with Java 7 byte code the future use of this great but abandoned library is questionable. Therefore maintaining a EMMA-only plug-in does not look reasonable in the long run. Users explicitly bound to EMMA may continue using the EclEmma 1.x stream (see below). Providing a plugable architecture for different coverage libraries looks like best practice at the first glance. This is how the overall Eclipse platform has been successfully crafted. When looking at different code coverage libraries features and integration strategies are very different. For example EMMA requires a huge overhead for instrumentation of local class files and hooks to tweak class paths. JaCoCo in contrast does not require this but gives additional coverage metrics and source highlighting for branch coverage. A code coverage framework would therefore either be
On the other hand the Eclipse launch and debug framework already is a plugable architecture that allows different integrations for different code coverage technologies even today. Functional ImprovementsFor EclEmma 2.0 the following functional improvements are planned: Branch Coverage
This additional metric will show coverage of all decision points in the
program flow due to Faster LaunchingDue the way how the JaCoCo coverage library works there will be no additional delay any more when applications under test are launched. This is an significant performance improvement especially for large applications and test suites. Less InvasiveCertain launch types and test scenarios require so called in-place instrumentation in EclEmma 1.x. With this option the original class files get modified on disk and need to be restored with a clean build when switching back to another launch mode. Also JAR files where excluded from coverage analysis when in-place mode is activated. Without in-place instrumentation the class path of the application under test was modified which caused trouble for some applications. With EclElmma 2.0 class files on disk will never be modified and the class path of an applications stays untouched. This will remove several hassles especially for Eclipse application launches and JUnit plug-in tests. Intermediate and Remote Coverage AnalysisJaCoCo 2.0 (or more likely one of its subsequent versions) will support intermediate coverage dumps on applications running locally or remote without stopping the applications under test. This will also allow to reset the collected coverage information for a running application. Flexible Analysis ScopeThe scope of a coverage analysis can be modified at any time afterwards. While in EclEmma 1.x the scope needs to be specified on the coverage launch dialog before the application is launched, with EclEmma 2.0 the scope can be altered at any time when the result of the coverage session is viewed. The Plug-in Project NameBack in 2006 EclEmma originally was an acronym formed from the project names Eclipse and EMMA. Today the name is widely used for code coverage in Eclipse without an focus on the technology used internally. Therefore the name should be kept, also for the plug-in Ids and Java package names. Which directly leads to the next point. Update from EclEmma 1.x to EclEmma 2.0Once EclEmma 2.0 has been stabilized and the first release is published EclEmma users should be able to get the new JaCoCo based implementation simply through the regular update site process. System RequirementsEclEmma 2.0 will raise the bar a little bit and has the following system requirements:
Future support for EMMA and EclEmma 1.x MaintenanceFrom EclEmma 2.0 on EMMA will not be supported any more as a coverage engine. The only supported backend will be JaCoCo. There are not plans for a "plugable" architecture to facilitate different coverage engines. The technologies are simply too different to efficiently integrate them based on a common framework. Beside this we will try to maintain the EMMA based 1.x stream on a best effort base but with no functional enhancements planned. There will be a separate download for the 1.x versions. Various Implementation ConsiderationsFor a new EclEmma 2.x the following ideas should be considered:
References
|
Copyright © 2006, 2017 Mountainminds GmbH & Co. KG and Contributors | Validate XHTML/CSS · Last Modified 2017-03-28 in Commit 1ce487ba |