Hi Ashish, this looks good so far. At least a few lines are marked as covered. So execution data seems to be collected correctly.
What I would do next is to add some proof that the code in question ist actually executed during the JaCoCo test run. For example add logging of throw an exception. Regards, -marc > On 1. Jun 2024, at 09:27, Ashish Ranjan Sinha <[email protected]> > wrote: > > Hi Marc, > > I see the class is already part of the session page. However I am still > getting the 0% code coverage for it. > > <2024-06-01_12-46-59.png> > > <2024-06-01_12-46-35.png> > > The same test and class files are used for Cobertura and I could see the > coverage is high for these classes. FYI - I am using openJDK17 with RHEL 8.9. > I am using runtime instrumentation for the classes. > > > Regards, > Ashish > > On Wednesday, May 29, 2024 at 11:27:15 PM UTC+5:30 Marc R. Hoffmann wrote: > Hi Ashish, > > our FAQ <https://www.jacoco.org/jacoco/trunk/doc/faq.html> contains some > information about this. Did you already check? > > Regards, > -marc > > Why does a class show as not covered although it has been executed? > First make sure execution data has been collected. For this select the > Sessions link on the top right corner of the HTML report and check whether > the class in question is listed. If it is listed but not linked the class at > execution time is a different class file. Make sure you're using the exact > same class file at runtime as for report generation. Note that some tools > (e.g. EJB containers, mocking frameworks) might modify your class files at > runtime. Please see the chapter about class ids > <https://www.jacoco.org/jacoco/trunk/doc/classids.html> for a detailed > discussion. > > > > > >> On 28. May 2024, at 11:31, Ashish Ranjan Sinha <[email protected] <>> >> wrote: >> > >> Hi, >> >> I am using Jacoco 0.8.11 for OpenJDK17. We are using Runtime instrumentation >> for instrumenting the .class files under the multiple packages. I am >> attaching the java agent to the JVM and restarting my system. Then running >> my Junits which is integrated test running separately on Jenkins pipeline. >> Once the Junits are run, jacoco.exec is flushed with executable data >> collected during junits. I am generating the report using the Jacoco cli >> command and storing the report under coverage/index.html. >> >> However, I observe some of the classes having 0% despite the associated >> Junit test running against it. When compared with Cobertura coverage report, >> the jacoco report shows very less coverage for the same set of classes and >> Junits. >> >> >> Need some guidance as what I am doing wrong here. >> >> >> Regards, >> Ashish. >> >> > >> -- >> 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/c7eb0406-d655-477d-a1c0-41c5ddf8117en%40googlegroups.com >> >> <https://groups.google.com/d/msgid/jacoco/c7eb0406-d655-477d-a1c0-41c5ddf8117en%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] > <mailto:[email protected]>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/jacoco/e3bcd9be-41a4-41e1-84f3-6bbc8b12c0c7n%40googlegroups.com > > <https://groups.google.com/d/msgid/jacoco/e3bcd9be-41a4-41e1-84f3-6bbc8b12c0c7n%40googlegroups.com?utm_medium=email&utm_source=footer>. > <2024-06-01_12-46-35.png><2024-06-01_12-46-59.png> -- 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/2E12B2D2-0203-40F3-8501-CD18793B58C2%40mountainminds.com.
