Correct, now I noticed there is a warning in the log, don't know why I missed it before.
I will try offline analysis or |classdumpdir |and update you how it goes.

Thanks.

[WARNING] Classes in bundle 'coverage_example' do no match with execution data. For report generation the same class files must be used as at runtime. [WARNING] Execution data for class com/novarto/coverage_example/FooServlet does not match.


On 3.06.2014 19:16, Marc Hoffmann wrote:
Ok, then this looks like a class file missmatch which happens when different class files are used at runtime and for reporting. I recently wrote some documentation about this problem:

  http://www.eclemma.org/jacoco/trunk/doc/classids.html

Here you find additional info how to detect and fixt this situation.

Best regards,
-marc




On 2014-06-03 16:47, Dimitar Georgiev wrote:
Hello,
 Seems I have attached to the server. Here is the servlet class in the
integration test exec file:
 24576da3b99d698f    2 of   2
com/novarto/coverage_example/FooServlet

 But the coverage is 0%.

 I have configured the jetty to be instrumented:
 <executions>
                     <execution>
                         <id>start-jetty</id>

<phase>pre-integration-test</phase>
                         <goals>

<goal>run-forked</goal>
                         </goals>
                         <configuration>

<waitForChild>false</waitForChild>

<jvmArgs>${failsafeArgLine}</jvmArgs>
                         </configuration>
                     </execution>
                     <execution>
                         <id>stop-jetty</id>

<phase>post-integration-test</phase>
                         <goals>
                             <goal>stop</goal>
                         </goals>
                     </execution>
                 </executions>

             </plugin>

 Side note: I've disabled the instrumentation in failsafe itself:
 <!--argLine>${failsafeArgLine}</argLine-->
 I don't think I need it as I don't have anything to cover in the test
JVM. Even if I enable it, though, the coverage report results are the
same - 0% for the production code (however, the dump includes the test
class in that case.)

 Any ideas?
 Does somebody care to have a look at the example project?
 - You can generate the .exec files using 'mvn verify'
 - You can generate the code coverage html reports using mvn verify
site

 Thanks in advance.
 Regards, Dimitar

On 30.05.2014 17:29, Marc R. Hoffmann wrote:

Hi,

with app servers it is always tricky that the JVM actually gets
attached to the right JVM (where your code under test is supposed to
be executed). As a first step I recommend to verify that the created
jacoco.exec file actually contains the classes under test.

You can open the jacoco.exec file directly with Eclipse (if EclEmma
is installed) or use the ExecDump example:
http://www.eclemma.org/jacoco/trunk/doc/api.html [4]

Best regards,
-marc

On 29.05.14 13:51, [email protected] wrote:

Hi Folks,

I am trying to setup integration tests and unit tests for a web
app utilizing maven 3, Jetty 9, JaCoCo newest, surefire and
failsafe.

I looked into all the discussions about this topic, but seems
noone has got this working yet. So here is my minimalistic
example. This is really as small as it gets, I think.

https://github.com/dimitarg/jetty-ci [1]
https://github.com/dimitarg/jetty-ci/tree/master/coverage_example
[2]

I have setup Jacoco in Maven, hopefully correctly, and am running
both unit and integration tests.
The unit tests (com.novarto.coverage_example.HelperTest)
successfully cover the code com.novarto.coverage_example.Helper.
The integration tests
(com.novarto.coverage_example.systest.ServletTest) invoke the
servlet com.novarto.coverage_example.FooServlet using the apache
HTTPClient. But the code does not get covered in the report.

The setup is: failsafe in its own JVM (as is the standard) , and
Jetty in its own JVM ( which happens by saying
<goal>run-forked</goal> in <phase>pre-integration-test</phase>)

If you run the example with mvn verify site -e -X , you will see
(as can also be seen in log.txt) , that the Jetty is properly
configured with the Agent argument (pasted below for your
convenience).

Can you help find the reason why the coverage of the classes in
the servlet container does not happen?

Thanks in advance.

[DEBUG] [/usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java,


-javaagent:/home/fmap/.m2/repository/org/jacoco/org.jacoco.agent/0.7.1.201405082137/org.jacoco.agent-0.7.1.201405082137-runtime.jar=destfile=/home/fmap/work/eclipse_ws/nemo_cofig/coverage_example/target/coverage-reports/jacoco-ut.exec,
-cp,


/home/fmap/.m2/repository/org/sonatype/sisu/sisu-inject-bean/2.1.1/sisu-inject-bean-2.1.1.jar:/home/fmap/.m2/repository/org/sonatype/sisu/sisu-guice/2.9.4/sisu-guice-2.9.4-no_aop.jar:/home/fmap/.m2/repository/org/codehaus/plexus/plexus-utils/2.0.6/plexus-utils-2.0.6.jar:/home/fmap/.m2/repository/org/sonatype/aether/aether-util/1.11/aether-util-1.11.jar:/home/fmap/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.14/plexus-interpolation-1.14.jar:/home/fmap/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar:/home/fmap/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.jar:/home/fmap/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar:/home/fmap/.m2/repository/org/apache/maven/plugin-tools/maven-plugin-tools-api/3.1/maven-plugin-tools-api-3.1.jar:/home/fmap/.m2/repository/backport-util-concurrent/backport-util-concurrent/3.1/backport-util-concurren
t-3.1.jar


:/home/fmap/.m2/repository/org/eclipse/jetty/jetty-util/9.1.5.v20140505/jetty-util-9.1.5.v20140505.jar:/home/fmap/.m2/repository/org/eclipse/jetty/jetty-webapp/9.1.5.v20140505/jetty-webapp-9.1.5.v20140505.jar:/home/fmap/.m2/repository/org/eclipse/jetty/jetty-xml/9.1.5.v20140505/jetty-xml-9.1.5.v20140505.jar:/home/fmap/.m2/repository/org/eclipse/jetty/jetty-servlet/9.1.5.v20140505/jetty-servlet-9.1.5.v20140505.jar:/home/fmap/.m2/repository/org/eclipse/jetty/jetty-jaas/9.1.5.v20140505/jetty-jaas-9.1.5.v20140505.jar:/home/fmap/.m2/repository/org/eclipse/jetty/jetty-security/9.1.5.v20140505/jetty-security-9.1.5.v20140505.jar:/home/fmap/.m2/repository/org/eclipse/jetty/jetty-plus/9.1.5.v20140505/jetty-plus-9.1.5.v20140505.jar:/home/fmap/.m2/repository/org/eclipse/jetty/jetty-jndi/9.1.5.v20140505/jetty-jndi-9.1.5.v20140505.jar:/home/fmap/.m2/repository/org/eclipse/jetty/jetty-server/9.1.5.v20140505/jetty-server-9.1.5.v20140505.jar:/home/fmap/.m2/repository/javax/servlet/javax.ser
v
l et-api/3.


1.0/javax.servlet-api-3.1.0.jar:/home/fmap/.m2/repository/org/eclipse/jetty/jetty-http/9.1.5.v20140505/jetty-http-9.1.5.v20140505.jar:/home/fmap/.m2/repository/org/eclipse/jetty/jetty-io/9.1.5.v20140505/jetty-io-9.1.5.v20140505.jar:/home/fmap/.m2/repository/org/eclipse/jetty/jetty-jmx/9.1.5.v20140505/jetty-jmx-9.1.5.v20140505.jar:/home/fmap/.m2/repository/org/eclipse/jetty/jetty-annotations/9.1.5.v20140505/jetty-annotations-9.1.5.v20140505.jar:/home/fmap/.m2/repository/javax/annotation/javax.annotation-api/1.2/javax.annotation-api-1.2.jar:/home/fmap/.m2/repository/org/ow2/asm/asm/4.1/asm-4.1.jar:/home/fmap/.m2/repository/org/ow2/asm/asm-commons/4.1/asm-commons-4.1.jar:/home/fmap/.m2/repository/org/ow2/asm/asm-tree/4.1/asm-tree-4.1.jar:/home/fmap/.m2/repository/org/eclipse/jetty/websocket/javax-websocket-server-impl/9.1.5.v20140505/javax-websocket-server-impl-9.1.5.v20140505.jar:/home/fmap/.m2/repository/org/eclipse/jetty/websocket/javax-websocket-client-impl/9.1.5.v20140505
/
j avax-webs


ocket-client-impl-9.1.5.v20140505.jar:/home/fmap/.m2/repository/javax/websocket/javax.websocket-api/1.0/javax.websocket-api-1.0.jar:/home/fmap/.m2/repository/org/eclipse/jetty/websocket/websocket-server/9.1.5.v20140505/websocket-server-9.1.5.v20140505.jar:/home/fmap/.m2/repository/org/eclipse/jetty/websocket/websocket-common/9.1.5.v20140505/websocket-common-9.1.5.v20140505.jar:/home/fmap/.m2/repository/org/eclipse/jetty/websocket/websocket-api/9.1.5.v20140505/websocket-api-9.1.5.v20140505.jar:/home/fmap/.m2/repository/org/eclipse/jetty/websocket/websocket-client/9.1.5.v20140505/websocket-client-9.1.5.v20140505.jar:/home/fmap/.m2/repository/org/eclipse/jetty/websocket/websocket-servlet/9.1.5.v20140505/websocket-servlet-9.1.5.v20140505.jar:/home/fmap/.m2/repository/org/eclipse/jetty/jetty-jsp/9.1.5.v20140505/jetty-jsp-9.1.5.v20140505.jar:/home/fmap/.m2/repository/org/eclipse/jetty/toolchain/jetty-schemas/3.1.M0/jetty-schemas-3.1.M0.jar:/home/fmap/.m2/repository/javax/servlet/
j
s p/javax.s


ervlet.jsp-api/2.3.1/javax.servlet.jsp-api-2.3.1.jar:/home/fmap/.m2/repository/org/glassfish/web/javax.servlet.jsp/2.3.2/javax.servlet.jsp-2.3.2.jar:/home/fmap/.m2/repository/org/eclipse/jetty/orbit/javax.servlet.jsp.jstl/1.2.0.v201105211821/javax.servlet.jsp.jstl-1.2.0.v201105211821.jar:/home/fmap/.m2/repository/org/glassfish/web/javax.servlet.jsp.jstl/1.2.2/javax.servlet.jsp.jstl-1.2.2.jar:/home/fmap/.m2/repository/org/glassfish/javax.el/3.0.0/javax.el-3.0.0.jar:/home/fmap/.m2/repository/org/eclipse/jetty/orbit/org.eclipse.jdt.core/3.8.2.v20130121/org.eclipse.jdt.core-3.8.2.v20130121.jar:/home/fmap/.m2/repository/javax/transaction/javax.transaction-api/1.2/javax.transaction-api-1.2.jar:/home/fmap/.m2/repository/org/eclipse/jetty/jetty-maven-plugin/9.1.5.v20140505/jetty-maven-plugin-9.1.5.v20140505.jar,
org.eclipse.jetty.maven.plugin.Starter, --stop-port, 8079,
--stop-key, stop, --props,


/home/fmap/work/eclipse_ws/nemo_cofig/coverage_example/target/fork.props,
--token, -16RZA73Q0EV8V]
[INFO] Forked process starting
[INFO] Forked process started.
--
You received this message because you are subscribed to the
Google Groups "JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it,
send an email to [email protected].
For more options, visit https://groups.google.com/d/optout [3].

--
You received this message because you are subscribed to a topic in
the Google Groups "JaCoCo and EclEmma Users" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/jacoco/XVzmmrmHwrk/unsubscribe
[5].
To unsubscribe from this group and all its topics, send an email to
[email protected].
For more options, visit https://groups.google.com/d/optout [3].

 --
 You received this message because you are subscribed to the Google
Groups "JaCoCo and EclEmma Users" group.
 To unsubscribe from this group and stop receiving emails from it,
send an email to [email protected].
 For more options, visit https://groups.google.com/d/optout [3].


Links:
------
[1] https://github.com/dimitarg/jetty-ci
[2] https://github.com/dimitarg/jetty-ci/tree/master/coverage_example
[3] https://groups.google.com/d/optout
[4] http://www.eclemma.org/jacoco/trunk/doc/api.html
[5] https://groups.google.com/d/topic/jacoco/XVzmmrmHwrk/unsubscribe


--
You received this message because you are subscribed to the Google Groups "JaCoCo 
and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to