<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">
<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>
                                <td>
                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>
                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px; -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
JBoss Tools Tycho Build Code Coverage Report
</h3>
<span style="margin-bottom: 10px;">
modified by <a href="http://community.jboss.org/people/dgolovin">Denis Golovin</a> in <i>JBoss Tools</i> - <a href="http://community.jboss.org/community/jbosstools/blog/2010/07/07/jboss-tools-tycho-build-code-coverage-report">View the full blog post</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">
<div class="jive-rendered-content"><p>JBoss 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:</p><ul><li>emma.filter - emma filter to define what packages to include to or to exclude from report</li><li>emma.instrument.bundles - comma separated list of bundles to be instrumented on the fly during tests execution</li></ul><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Here is an example from org.jboss.tools.common.test plug-ins</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><pre class="jive-pre"><code class="jive-code jive-xml"><span class="jive-xml-tag"><properties></span>
     <span class="jive-xml-tag"><emma.filter></span>org.jboss.tools.common*<span class="jive-xml-tag"></emma.filter></span>
     <span class="jive-xml-tag"><emma.instrument.bundles></span>org.jboss.tools.common<span class="jive-xml-tag"></emma.instrument.bundles></span>
<span class="jive-xml-tag"></properties></span>
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>To enable code coverage report generation during build</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><pre class="jive-pre"><code class="jive-code">-Dcoverage
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>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</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><pre class="jive-pre"><code class="jive-code">     [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] -------------------------------------------------------------------------------
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Reports are generated to /target/emma folder of test plug-in.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>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.</p></div>
<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
<p style="margin: 0;">Comment by <a href="http://community.jboss.org/community/jbosstools/blog/2010/07/07/jboss-tools-tycho-build-code-coverage-report">going to Community</a></p>
</div></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>