Hi Kumar,

if it two different versions of the same class JaCoCo has no chance to merge 
the coverage data from both. Imagine test with version A has full coverage on a 
method but version B has the same method with an additional branch and no 
coverage. What should be the merged coverage report?

If you want to combine test runs from different hosts you must make sure that 
you deploy the same version to both of them.

Regards,
-marc

> On 10. Feb 2021, at 06:28, Kumar Dp <[email protected]> wrote:
> 
> Thanks Evgeny for your reply. Please help with below queries,
> 
> Here is my requirement and want to generate report by merging the two 
> different runs on two different hosts
> 
> Run1 on Host1:
>  ->  
> -javaagent:/u01/jacoco/lib/jacocoagent.jar=destfile=/u01/jacoco/dump/jacoco.exec,classdumpdir=/u01/jacoco/dump/class,output=file,address=,includes=apps.applcore.*
> - > Class files dumped for tests 
> DescriptiveFlexfieldTag.2419d92cd2c6a871.class and 
> ConvertNumberTag.37bfad455e453d93.class
> 
> Run 2 on Host2 :
>  ->  
> -javaagent:/u01/jacoco/lib/jacocoagent.jar=destfile=/u01/jacoco/dump/jacoco.exec,classdumpdir=/u01/jacoco/dump/class,output=file,address=,includes=apps.applcore.*
> - > Class files dumped for tests 
> DescriptiveFlexfieldTag.49dc0cd2912591ec.class and 
> ConvertNumberTag.d7c0cf501f15a429.class
> 
> I  merged multiple exec files collected from HOST and HOST2 into a new one 
> using java -jar jacococli.jar merge
> 
> Now when I try to generate report using below command, I'm getting "Can not 
> have same class" issue.
> 
> java -jar jacococli.jar report /scratch/jacoco/dump/jacoco/dest/merged.exec 
> /scratch/dump/jacoco.exec --classfiles "/scratc/jacoco/dump1/jacoco/classes/" 
> --classfiles <classes from HOST1> --classfiles <classes from HOST2> --csv 
> /scratch/final_report/mycsv.csv --html /scratch/final_report --name "Code 
> Coverage"
> 
> Hence I removed or excluded classes from HOST2 and generating report using 
> below command,
> 
> java -jar jacococli.jar report /scratch/jacoco/dump/jacoco/dest/merged.exec 
> /scratch/dump/jacoco.exec --classfiles "/scratc/jacoco/dump1/jacoco/classes/" 
> --classfiles <classes from HOST1>  --csv /scratch/final_report/mycsv.csv 
> --html /scratch/final_report --name "Code Coverage"
> 
> My query is, 
> 
> - Will I be able to still achieve the right code coverage? Since I have 
> excluded the classes from HOST2. 
> 
> Referring below FAQs in the doc 
> https://www.eclemma.org/jacoco/trunk/doc/classids.html, 
> 
> What is the disadvantage of JaCoCo class ids?
> The fact that class ids identify a specific version of a class causes 
> problems in setups where different classes are used at runtime and at 
> analysis time.
> 
> What happens if different classes are used at runtime and at analysis time?
> In this case execution data cannot be related to the analyzed classes. As a 
> consequence such classes are reported with 0% coverage.
> 
> 
> Thanks and Regards,
> Kumar
> 
> On Tuesday, February 9, 2021 at 4:13:50 PM UTC+5:30 Evgeny Mandrikov wrote:
> You're missing
> 
> --classfiles
> 
> for the second directory
> 
> "/scratch/jacoco/dump2/class/"
> 
> i.e.
> 
> java -jar jacococli.jar report /scratch/jacoco/dump/jacoco/dest/merged.exec 
> /scratch/dump/jacoco.exec --classfiles "/scratc/jacoco/dump1/jacoco/classes/" 
> --classfiles "/scratch/jacoco/dump2/class/" --csv 
> /scratch/final_report/mycsv.csv --html /scratch/final_report --name "Code 
> Coverage"
> 
> On Tuesday, February 9, 2021 at 11:40:57 AM UTC+1 Kumar Dp wrote:
> I have two different test execution which resulted in two code coverage file 
> (*.exec) and classes got dumped to two different folders.
> 
> Below command is failing when I run the report command using java cli mode.
> 
> java -jar jacococli.jar report /scratch/jacoco/dump/jacoco/dest/merged.exec 
> /scratch/dump/jacoco.exec --classfiles "/scratc/jacoco/dump1/jacoco/classes/" 
> "/scratch/jacoco/dump2/class/" --csv /scratch/final_report/mycsv.csv --html 
> /scratch/final_report --name "Code Coverage"
> [INFO] Loading execution data file  
> /scratch/jacoco/dump/jacoco/dest/merged.exec  .
> [INFO] Loading execution data file  /scratch/dump/jacoco.exec  .
> [INFO] Loading execution data file /scratch/kumar/jacoco/fnd/dump/class.
> Exception in thread "main" java.io.FileNotFoundException:  
> /scratch/jacoco/dump2/class  (Is a directory)
>       at java.io.FileInputStream.open0(Native Method)
>       at java.io.FileInputStream.open(FileInputStream.java:195)
>       at java.io.FileInputStream.<init>(FileInputStream.java:138)
>       at 
> org.jacoco.cli.internal.core.tools.ExecFileLoader.load(ExecFileLoader.java:72)
>       at 
> org.jacoco.cli.internal.commands.Report.loadExecutionData(Report.java:99)
>       at org.jacoco.cli.internal.commands.Report.execute(Report.java:83)
>       at org.jacoco.cli.internal.Main.execute(Main.java:90)
>       at org.jacoco.cli.internal.Main.main(Main.java:105)
> 
> 
> Please suggest how to pass multiple class path directories for report 
> generation.
> 
> I'm following the instruction from 
> https://www.jacoco.org/jacoco/trunk/doc/cli.html 
> <https://www.jacoco.org/jacoco/trunk/doc/cli.html>,
> where it is mentioned that  "--classfiles <path> location of Java class 
> files" is multiple.
> 
> Regards,
> Kumar
> 
> 
> 
> -- 
> 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]>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/jacoco/dd11c97d-ba00-4ea8-a33a-70222cf2eb10n%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/jacoco/dd11c97d-ba00-4ea8-a33a-70222cf2eb10n%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
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/BCE468EB-1289-4619-A7A4-221B18CA49AD%40mountainminds.com.

Reply via email to