
JBoss Tools Tycho Build Code Coverage Report
Posted by dgolovin in JBoss Tools on Jul 7, 2010 4:03:49 PMJBoss Tools tycho build now provides code coverage report for eclipse-test-plugins. All eclipse-test-plugin pom.xml files provide meta information about what bundles are instrumented and what classes are included in coverage report through properties:
- emma.filter - emma filter to define what packages to include to or to exclude from report
- emma.instrument.bundles - comma separated list of bundles to be instrumented on the fly during tests execution
Here is an example from org.jboss.tools.common.test plug-ins
<properties> <emma.filter>org.jboss.tools.common*</emma.filter> <emma.instrument.bundles>org.jboss.tools.common</emma.instrument.bundles> </properties>
To enable code coverage report generation during build
-Dcoverage
system property should be added to build command line. It activates maven coverage profile to generate coverage reports on per test plug-in basis in text and xml formats. Text reports are printed out to the build console output like
[echo] [EMMA v2.0.5312 report, generated Wed Jul 07 12:11:50 PDT 2010] [echo] ------------------------------------------------------------------------------- [echo] OVERALL COVERAGE SUMMARY: [echo] [echo] [class, %] [method, %] [block, %] [line, %] [name] [echo] 61% (22/36)! 28% (93/328)! 17% (1056/6326)! 20% (308.2/1575)! all classes [echo] [echo] OVERALL STATS SUMMARY: [echo] [echo] total packages: 8 [echo] total classes: 36 [echo] total methods: 328 [echo] total executable files: 28 [echo] total executable lines: 1575 [echo] [echo] COVERAGE BREAKDOWN BY PACKAGE: [echo] [echo] [class, %] [method, %] [block, %] [line, %] [name] [echo] 0% (0/1)! 0% (0/7)! 0% (0/78)! 0% (0/16)! org.jboss.tools.common.preferences [echo] 0% (0/2)! 0% (0/40)! 0% (0/492)! 0% (0/125)! org.jboss.tools.common.text [echo] 17% (1/6)! 4% (3/77)! 4% (92/2401)! 4% (24.9/562)! org.jboss.tools.common.util [echo] 67% (4/6)! 35% (11/31)! 19% (77/396)! 23% (23.2/102)! org.jboss.tools.common.reporting [echo] 75% (6/8)! 33% (25/75)! 21% (367/1734)! 24% (99.2/419)! org.jboss.tools.common.xml [echo] 75% (3/4)! 48% (11/23)! 24% (135/562)! 32% (44.1/139)! org.jboss.tools.common [echo] 75% (3/4)! 42% (23/55)! 36% (153/422)! 36% (52.4/144)! org.jboss.tools.common.log [echo] 100% (5/5) 100% (20/20) 96% (232/241) 95% (64.4/68) org.jboss.tools.common.zip [echo] -------------------------------------------------------------------------------
Reports are generated to /target/emma folder of test plug-in.
To enable code coverage for your test plug-in just add properties listed above to your plug-in pom.xml file and activate coverage profile as it explained above.
Comments