I'm a newbie to Jacoco. I needed to perform some code coverage in our webapp. The webapp is shipped as a war file running on tomcat application server. Since I don't have the build information for the webapp as well the source repository for it, the on-fly looked most viable option for me.
I have defined the following in setenv.sh file:
JACOCO_OPTS="-javaagent:/portal/bin/jacoco/lib/jacocoagent.jar=destfile=JACOCO_EXEC_FILE,output=file,append=false"
CATALINA_OPTS="${CATALINA_OPTS} ${JACOCO_OPTS}
when i start the webapp i do the file being created when i do browse the site and shutdown catalina.sh i still the file size as 0
root@xxx-xxxx:/xxxxxxx/bin# ./shutdown.sh
Using CATALINA_BASE: /xxxxxx
Using CATALINA_HOME: /xxxxxx
Using CATALINA_TMPDIR: /xxxxxx/xxxx
Using JRE_HOME: /usr
Using CLASSPATH: /xxxxxxx/bin/bootstrap.jar:/portal/bin/tomcat-juli.jar
-rw-r----- 1 root root 0 Mar 3 16:07 JACOCO_EXEC_FILE
drwxr-x--- 3 root root 4096 Mar 3 16:13 .
i'm using the following versions:
Server version: Apache Tomcat/8.5.29
Server built: Mar 5 2018 13:11:12 UTC
Server number: 8.5.29.0
OS Name: Linux
OS Version: 4.4.0-116-generic
Architecture: amd64
JVM Version: 1.8.0_191-8u191-b12-2ubuntu0.16.04.1-b12
JVM Vendor: Oracle Corporation
The Jacoco version used is :
jacoco/0.8.3/jacoco-0.8.3.zip
I would appreciate of any insight into how to resolve the issue.
Thanks,
jk
JACOCO_OPTS="-javaagent:/xxxxx/bin/jacoco/lib/jacocoagent.jar=destfile=JACOCO_EXEC_FILE,output=file,append=false"
-rwxr-xr-x 1 root root 442 Mar 3 16:44 setenv.sh
-rw-r----- 1 root root 2086 Mar 3 16:47 JACOCO_EXEC_FILE
But now i need to create the report from the file. I would greatly appreciate if someone could help me on it. I tried the following:
java -jar <path to jacoco.jar> report JACOCO_EXEC_FILE --classfiles ../webapps/ROOT/WEB-INF/classes/ -html . -name output.html
It did generate the output.html but everything was 0% . I did minimalistic testing on website so it may be due to that. I'll try to do more exhaustive tests to check.
I would appreciate if someone could comment if i'm on the right track or if i should try something else.
Thanks,
jk.
2019/01/23 |
3.7 MB |
d4f07cb98bbf2305dbd16ee3012d7321 |
java -jar <path to jacoco directory>/lib/jacococli.jar report <exec file path> --classfiles <TOMCAT_HOME>/webapps/dummy/WEB-INF/classes/ --sourcefiles /opt/dummy/web-inf/classes/ --html /tmp/report
run command like above. you will get html report for sure.
Thanks,
Jiten
shutdown catalina.sh i still the file size as 0
--
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/DZNqIGaoPKQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jacoco+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/277a9bf5-66a7-4179-a933-a9867a797af9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
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/DZNqIGaoPKQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jacoco+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/b919b227-4d66-4c67-b357-48609f47b541%40googlegroups.com.
One question : sourcefiles parameter is that the location of the .java files?
I’m asking as I don’t have the access to the product code. Is it possible to generate the report for. Just the class files using —classfiles.
To unsubscribe from this group and all its topics, send an email to jacoco+un...@googlegroups.com.
cd /xxxxxx/webapps/ROOT/WEB-INF/classes/com
find . -type f -name "*class" -print0| xargs -0 -I {} cp {} ~/1/
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/412e4e3e-08f4-42b2-8823-179a6179b905%40googlegroups.com.
This is a follow question. Issue i'm seeing is the code coverage for all the packages is all 0%java -jar jacoco/lib/jacococli.jar report JACOCO_EXEC_FILE --classfiles ~/1/ --html reportAfter which i see the pakage structure created in output directory along with index.html and jacoco-session.html. However when i view the index.html the coverage is 0% for all
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 jacoco+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/f994b6f8-1bbe-413a-8050-c5550065d65c%40googlegroups.com.
This coverage report is based on execution data from the following sessions:
Session | Start Time | Dump Time |
portal-tb3-9520fd64 | Mar 6, 2019 7:13:24 AM | Mar 6, 2019 7:13:24 AM |
Execution data for the following classes is considered in this report:
Class | Id |
org.apache.catalina.LifecycleState | d852263a2396f00f |
org.apache.catalina.core.NamingContextListener | 452717f152912d7c |
org.apache.catalina.core.StandardServer | a7539e87b0244e61 |
org.apache.catalina.deploy.NamingResourcesImpl | 2f3f2a5bb2334e34 |
org.apache.catalina.security.SecurityClassLoad | 73724d336975ef8e |
org.apache.catalina.security.SecurityConfig | 20b1920b1c4845b0 |
org.apache.catalina.startup.Bootstrap | 761d4791c592d74a |
org.apache.catalina.startup.Catalina | 3f3b3bcb21c7df6e |
org.apache.catalina.startup.CatalinaProperties | 0a403607de81c2b1 |
org.apache.catalina.startup.ClassLoaderFactory | 637589ae074b37b0 |
org.apache.catalina.startup.ClassLoaderFactory.2 | f884fbe3ffea9504 |
org.apache.catalina.startup.ClassLoaderFactory.Repository | 64e04a8157026e9a |
org.apache.catalina.startup.ClassLoaderFactory.RepositoryType | 0512519c8a94741f |
org.apache.catalina.util.LifecycleBase | 462c20e1e81adf7d |
org.apache.catalina.util.LifecycleMBeanBase | 581fb22432fd3a3d |
org.apache.juli.logging.DirectJDKLog | 7ad56dd398c4a76e |
org.apache.juli.logging.LogFactory | d816f6f12317a8e5 |
org.apache.tomcat.util.ExceptionUtils | 8f45b5cc6c246f81 |
org.apache.tomcat.util.IntrospectionUtils | ad77a79a2458fa82 |
org.apache.tomcat.util.digester.ArrayStack | 710ed28fbfdd5d18 |
org.apache.tomcat.util.digester.Digester | efdd845ab94fb176 |
org.apache.tomcat.util.digester.Digester.SystemPropertySource | bb86c4e6ddcdbb24 |
org.apache.tomcat.util.digester.ObjectCreateRule | b3bc8f955478c572 |
org.apache.tomcat.util.digester.Rule | 0b92708415dbc6d9 |
org.apache.tomcat.util.digester.RulesBase | fa98b7be8cd3adbf |
org.apache.tomcat.util.digester.SetNextRule | 9d43f39c54fbaa21 |
org.apache.tomcat.util.digester.SetPropertiesRule | 8a71a46200ae5d2a |
org.apache.tomcat.util.res.StringManager | 7c3e9ecbdd9b53b0 |
org.apache.tomcat.util.res.StringManager.1 | 44bb08d6a97f529b |
JACOCO_OPTS=" -javaagent:<jacoco path>/jacoco/lib/jacocoagent.jar=destfile=<jacoco path>/jacoco/jacoco.exec,append=true,includes=a.b.c.d.*"
CATALINA_OPTS="${CATALINA_OPTS} ${JACOCO_OPTS}"
set to Catalina opts not in java opts: why? check below link.
"https://stackoverflow.com/questions/11222365/catalina-opts-vs-java-opts-what-is-the-difference"
and do the same thing again and check.
-Jitendra
The contents of the jacoce.exec file are cryptice looks like its a proprietary format , adding a screenshot here
One more data point, didn't mention it in my last email. In Jacoce session i don't see the webapp specific packages but generic java packages
Edit your setup.sh file as below:JACOCO_OPTS=" -javaagent:<jacoco path>/jacoco/lib/jacocoagent.jar=destfile=<jacoco path>/jacoco/jacoco.exec,append=true,includes=a.b.c.d.*"
CATALINA_OPTS="${CATALINA_OPTS} ${JACOCO_OPTS}"
set to Catalina opts not in java opts: why? check below link.
"https://stackoverflow.com/questions/11222365/catalina-opts-vs-java-opts-what-is-the-difference"
--
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/DZNqIGaoPKQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jacoco+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/8c463027-11c9-4ba0-8cc2-56c57ae485eb%40googlegroups.com.
I tried to run with the CATALINA_OPTS="${CATALINA_OPTS} ${JACOCO_OPTS}" but after which the jacoco.exec file generated is of 0 size.
--
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/DZNqIGaoPKQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jacoco+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/360af5af-c1e5-442b-946b-82191734b92e%40googlegroups.com.