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

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
https://github.com/dimitarg/jetty-ci/tree/master/coverage_example

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-concurrent-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.servlet-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/javax-websocket-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/jsp/javax.servlet.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] <mailto:[email protected]>.
For more options, visit https://groups.google.com/d/optout.

--
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