kelemen / netbeans-gradle-project

This project is a NetBeans plugin able to open Gradle based Java projects. The implementation is based on Geertjan Wielenga's plugin.
173 stars 57 forks source link

Jacoco Reporting is not work for me #408

Open makiam opened 5 years ago

makiam commented 5 years ago

Jacoco Code coverage report integration seems now work. Steps to reproduce: Run NB IDE with plugin Open some gradle project (Ex, I use samples/testing/jacoco/quickstart/groovy from gradle samples) From project context menu invoke Code Coverage -> Show Report In Report window click Run All Tests In output I see test and jacocoTestReport tasks executed and I can see report under /build/jacocoHtml folder but not in report window nor coverage over source code

I used a latest NB build (build from sources on my own) and JDK 1.8 update 152 x64

kelemen commented 5 years ago

It works for me. Can you share a project with which I can reproduce your issue? Also, I have found the code coverage window in NB a little fragile. So, you might want to close the report window and reopen.

makiam commented 5 years ago

Still not works for me I used this sample application: https://github.com/gradle/gradle/tree/master/subprojects/docs/src/samples/testing/jacoco/quickstart/groovy Also I see this exception in IDE log exception.txt

kelemen commented 5 years ago

Given the error message, I assume you are using Russian locale. It is just a guess, but that might have something to do with the issue. Can you attach the report.dtd and jacocoTestReport.xml referenced in the error message?

kelemen commented 5 years ago

Looking it a little more, it is probably not simply because of the locale but because the public ID of the dtd is not -//JACOCO//DTD Report 1.0//EN (I assume it is not EN but RU or something). Which version of NB are you using (or rather which version of this plugin)?

kelemen commented 5 years ago

Also, just in case: Can you send me your jacocoTestReport.xml?

makiam commented 5 years ago

I using the latest Netbeans dev build. Means I clone repository and build NB from sources.

I founв that exception is throwns when I set xml.enabled true. But *.dtd file is really missing jacocoTestReport.zip

kelemen commented 5 years ago

Thanks, the issue had nothing to do with the locale. Actually, the version of Jacoco DTD has changed. This issue should now be fixed in master. Can you verify?

makiam commented 5 years ago

See other Exception now: INFO [org.netbeans.gradle.project.coverage.GradleCoverageProvider]: Could not parse E:\Temp\quickstart\build\customJacocoReportDir\test\jacocoTestReport.xml java.lang.NullPointerException at java.net.URL.(URL.java:532) Caused: java.net.MalformedURLException at java.net.URL.(URL.java:627) at java.net.URL.(URL.java:490) at java.net.URL.(URL.java:439) at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:620) at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startEntity(XMLEntityManager.java:1304) at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startDTDEntity(XMLEntityManager.java:1270) at com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.setInputSource(XMLDTDScannerImpl.java:264) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.dispatch(XMLDocumentScannerImpl.java:1161) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.next(XMLDocumentScannerImpl.java:1045) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:959) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:841) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:770) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141) at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:243) at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:339) at org.openide.xml.XMLUtil.parse(XMLUtil.java:340) [catch] at org.netbeans.gradle.project.coverage.GradleCoverageProvider.parse(GradleCoverageProvider.java:182) at org.netbeans.gradle.project.coverage.GradleCoverageProvider.getResults(GradleCoverageProvider.java:214) at org.netbeans.modules.gsf.codecoverage.CoverageManagerImpl.showReport(CoverageManagerImpl.java:273) at org.netbeans.modules.gsf.codecoverage.CoverageAction$CoverageItemHandler.actionPerformed(CoverageAction.java:259)

makiam commented 5 years ago

FYI: test project repository: https://github.com/makiam/quickstart

kelemen commented 5 years ago

I have messed up the extensions. It should work now.

makiam commented 5 years ago

It works now, Amazing. Thanks a lot!

makiam commented 5 years ago

BTW. Is it possible to customize class coverage view colors? I see the jacoco coverage plugin for NB ant based projects. It offer to customize such colors for covered/partial/not covered lines. Also it can to show tooltip at gutter with covered/partial/not covered text

kelemen commented 5 years ago

This plugin just provides the meta-data of the code coverage and not the UI. So, there is only what NB provides for it. I assume you are talking about the TikiOne plugin. I will have to look at its source to check what it does to make this configurable.

kelemen commented 5 years ago

I took a quick look at that plugin and it seems, it manages these highlights itself unlike this plugin. So, I think you should ask the NB team to make code coverage highlights customizable (you can refer to the org-netbeans-modules-gsf-codecoverage library, which is what is used by this plugin).