Hi JK,

I need some inputs from you.

steps: 

1. Startup your tomcat/container and perform some operations on a web 
application so some of the class files consumed by some random operation 
like login etc.
2. Shutdown tomcat gracefully - /<tomcat server dir>/bin/shutdown.sh/bat 
etc.
3. now verify the size of generated jacoco.exec file in your case <
JACOCO_EXEC_FILE>

Now run "java -jar jacoco/lib/jacococli.jar report JACOCO_EXEC_FILE 
--classfiles ~/1/ --html report" command 

some more input like below:

while running above command what you are getting in the console I mean how 
many class files getting consumed.

[INFO] Loading execution data file JACOCO_EXEC_FILE.
[INFO] Analyzing <????> classes.

how many class files ?? and if possible share your exec file that would be 
great to solve the issue.

Thanks,
Jitendra


On Wednesday, March 6, 2019 at 12:48:16 PM UTC+5:30, jk wrote:
>
> Hi All,
>
> Thanks Jitender and Evgeny!
>
> 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 report 
>
> After 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
> [image: image.png]
>
>
> Note in the command above ~/1 is the directory where i have copied all the 
> .class files. Since i don't which class files are used i copied all the 
> class files for WEB-INF to 1 as follows:
>
> cd /xxxxxx/webapps/ROOT/WEB-INF/classes/com
>
>
> find . -type f -name "*class" -print0| xargs -0 -I {} cp {} ~/1/
>
> I would appreciate your help.
>
> Thanks,
> JK.
>
>
> On Mon, Mar 4, 2019 at 7:58 AM 'Jitendra Kumar' via JaCoCo and EclEmma 
> Users <[email protected] <javascript:>> wrote:
>
>> Hi JK,
>>
>> The answer is YES, but you will not get a meaningful report.
>> Assume in your application you have just accessed login page and assume 
>> LoginPage.java is executed, along with that some more java src consumed 
>> from LoginPage.java, so once .class files generated you will be able to 
>> generate the report without using the java source code of your project but 
>> .class & source mapping will not happen meant which code snippet is 
>> consumed (green highlighted) and which part is not even accessed or 
>> executed means may be dead code (red highlighted). 
>>
>> ultimately without the source, you will not be able to find dead code/un 
>> accessed code from your source code files for which you are using jacoco.
>>
>> Thanks,
>> Jiten
>>
>> On Monday, March 4, 2019 at 8:19:12 PM UTC+5:30, jk wrote:
>>>
>>> Hi Jiten,
>>>
>>> Thanks for your reply.
>>>
>>> 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.
>>>
>>> Thanks,
>>> Jk.
>>>
>>>
>>>
>>> On Sunday, March 3, 2019, 'Jitendra Kumar' via JaCoCo and EclEmma Users <
>>> [email protected]> wrote:
>>>
>>>> Hi JK,
>>>>
>>>> pre-requsites:
>>>>
>>>> downloa 
>>>>
>>>> *jacoco-0.8.3.zip 
>>>> <http://search.maven.org/remotecontent?filepath=org/jacoco/jacoco/0.8.3/jacoco-0.8.3.zip>*
>>>>
>>>> *0.8.3 <https://github.com/jacoco/jacoco/tree/v0.8.3>*
>>>>
>>>> 2019/01/23
>>>>
>>>> 3.7 MB
>>>>
>>>> d4f07cb98bbf2305dbd16ee3012d7321
>>>>
>>>> extract and navigate to lib directory, jacococli.jar will be there in 
>>>> lib dir.
>>>>
>>>> The most important thing while generating HTML report from the *.exec 
>>>> file is providing correct src and class files path so exec file can map 
>>>> the 
>>>> consumption of code and give you report HTML.
>>>> for that you run like below command:
>>>>
>>>> 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
>>>>
>>>>
>>>>
>>>>
>>>> On Monday, March 4, 2019 at 10:51:49 AM UTC+5:30, jk wrote:
>>>>>
>>>>> Hi All,
>>>>>
>>>>> 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
>>>>>
>>>>> -- 
>>>> 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 
>>>> [email protected].
>>>> To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/jacoco/277a9bf5-66a7-4179-a933-a9867a797af9%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/jacoco/277a9bf5-66a7-4179-a933-a9867a797af9%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>> 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 
>> [email protected] <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jacoco/412e4e3e-08f4-42b2-8823-179a6179b905%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jacoco/412e4e3e-08f4-42b2-8823-179a6179b905%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> 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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jacoco/d2d4b2b6-84e4-4334-8f35-dd93bd5d59df%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to