Bug 52151 - [PATCH] A code-coverage tool for code analysis
Summary: [PATCH] A code-coverage tool for code analysis
Alias: None
Product: Fop - Now in Jira
Classification: Unclassified
Component: general (show other bugs)
Version: 1.0
Hardware: PC Linux
: P2 normal
Target Milestone: ---
Assignee: fop-dev
Depends on:
Reported: 2011-11-08 09:12 UTC by Mehdi Houshmand
Modified: 2012-03-28 08:46 UTC (History)
0 users

jacoco code coverage (6.66 KB, patch)
2011-11-08 09:12 UTC, Mehdi Houshmand
Details | Diff
code coverage tool (8.80 KB, patch)
2011-11-16 11:44 UTC, Mehdi Houshmand
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mehdi Houshmand 2011-11-08 09:12:59 UTC
Created attachment 27909 [details]
jacoco code coverage

This patch adds a code-coverage ant task in jacoco.xml such that the invoking command would be:
ant -f jacoco.xml clean code-coverage

This, like the find-bugs task, requires that ${jacoco.lib} property is set best done in a build-local.properties file.

Jacoco is the successor to Emma, which is a well established code analysis tool
Comment 1 Vincent Hennebert 2011-11-08 16:27:19 UTC
Hi Mehdi,

There's no jacoco.xml in the patch?

Also, I assume you changed the hyphenation test so that it matches the *TestCase pattern. This is a good idea but setting the system property in the getParameters method probably is a bit too much magic. Plus you have to reset the property afterwards, which is brittle. Maybe the LayoutEngingTestUtils.getLayoutTestFiles method should be overloaded with a parameter that directly sets the test set instead of getting it from a system property.

Small detail in the junit-compile-copy-resources task in build.xml: by using the '**/*' pattern the Java files will also be copied, which will create unnecessary I/O.

Comment 2 Mehdi Houshmand 2011-11-16 11:44:14 UTC
Created attachment 27948 [details]
code coverage tool

Made the changes requested
Comment 3 Vincent Hennebert 2011-11-18 17:11:42 UTC
Patch applied in rev. 1203749:

I made the following changes to jacoco.xml:
- removed unnecessary ivy namespace declaration
- removed unused result.jacoco.report property
- renamed jacoco report dir to report_jacoco to follow the same pattern as the other tools (Checkstyle, FindBugs, etc.)
- changed classpath of task definition to only include ${jacocoant.jar}
- removed unused errorproperty and failureproperty from junit task
- removed unnecessary JUnit formatters: I think we can safely assume that, prior to getting coverage report, 'ant junit' has been run and that tests passed
- removed unnecessary merging of jacoco execution data since only one file is generated
- renamed targets to more descriptive names and added description to coverage-report target so that it appears when running ant -p
- other small clean ups