Whether jacoco will add probes in class that hasn’t a method ?

조회수 37회
읽지 않은 첫 메시지로 건너뛰기

wumangx...@gmail.com

읽지 않음,
2018. 9. 17. 오후 11:03:5018. 9. 17.
받는사람 JaCoCo and EclEmma Users
Hi ,there

when we write code,we may write some constant class or some enumeration class,will jacoco add probes in this kind of class? Can jacoco get coverage rate of this kind of class?


Best regards

Qiao



Marc Hoffmann

읽지 않음,
2018. 9. 18. 오전 1:24:3718. 9. 18.
받는사람 jac...@googlegroups.com
Hi Qiao,

JaCoCo instruments every class files that has at least one method.

* Even a empty Java class will still get a default constructor.
* For enums the compiler generates several methods
* Only interfaces can result in class files without methods

I’m not sure what you mean by “coverage rate of this kind of class”. Some Infos:

* The latest versions of JaCoCo filter out compiler generated code, so you will not see any coverage data e.g. for enums.
* Access to public members (like constants or enum values) of such classes does not involve code execution and cannot be measured.

Regards,
-marc
> --
> 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/a5704f0d-2771-4fba-962f-d6497a7c52da%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

wumangx...@gmail.com

읽지 않음,
2018. 9. 18. 오전 5:04:3918. 9. 18.
받는사람 JaCoCo and EclEmma Users
Thanks ,Marc.
I have another question.The senecio is as follows.
My boss want me to change the jacoco to support creating recovery report on the code that has changed or added on a new branch compared to the master branch. Actually,I have asked a similar question before and you told me that sonarqube can do this .
But, the question is my boss insisting using jacoco.So I have changed the classes named Analyzer and ClassAnalyzer to filter the class and method that has not changed or add when jacoco analyzing the class file.So I almost realize this figure.But ,there is one last problem. That is when I creating html format report ,it can not generate ‘.java.html’ file for ‘.java’ file . I have no idea of why it doesn’t generate this type file ,maybe it is because that the bundlecoverage doesn’t match the source file?
In ‘.java.html’ file, the blue lines means covered and the red line means not covered . It is very convinient for me to analysis code. So can you give me some hint of which part of the source code should I change to create the final ‘.java.html’ file?

Beat regards

Qiao

Marc Hoffmann

읽지 않음,
2018. 9. 18. 오전 10:56:0518. 9. 18.
받는사람 jac...@googlegroups.com
Please first check what is described in the FAQ:


Why does the coverage report not show highlighted source code?

Make sure the following prerequisites are fulfilled to get source code highlighting in JaCoCo coverage reports:

  • Class files must be compiled with debug information to contain line numbers.
  • Source files must be properly supplied at report generation time. I.e. specified source folders must be the direct parent of the folders that define the Java packages.

Regards,
-marc


--
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.

wumangx...@gmail.com

읽지 않음,
2018. 9. 18. 오후 10:10:4518. 9. 18.
받는사람 JaCoCo and EclEmma Users
thank you for answering my question which really helped me .

wumangx...@gmail.com

읽지 않음,
2018. 9. 23. 오후 11:05:2518. 9. 23.
받는사람 JaCoCo and EclEmma Users
Hi,Marc

I encountered another question. When I try ‘mvn install’ to the source code of jacoco. I can can get org.jacoco.core.jar, org.jacoco.report.jar, org.jacoco.agent.jar,jacocoagent.jar, org.jacoco.ant.jar.But I can’t get jaococant.jar which is used by ant *.xml file.

The result of ‘mvn install’ is success. Do you have any idea of my problem?

Best regards
Qiao

Evgeny Mandrikov

읽지 않음,
2018. 9. 24. 오전 1:06:3618. 9. 24.
받는사람 JaCoCo and EclEmma Users
Hi,

JAR with groupId "org.jacoco" artifactId "org.jacoco.ant" and classifier "nodeps"
is Ant Tasks with all dependencies included,
after "mvn install" it is "org.jacoco.ant/target/org.jacoco.ant-0.8.3-SNAPSHOT-nodeps.jar"
and it is exactly "jacocoant.jar" in "jacoco/target/jacoco-0.8.3.201809240506.zip".


Regards,
Evgeny

wumangx...@gmail.com

읽지 않음,
2018. 9. 24. 오전 4:05:5918. 9. 24.
받는사람 JaCoCo and EclEmma Users
thank you very much
전체답장
작성자에게 답글
전달
이 대화는 잠겨 있습니다
잠긴 대화에서는 답장하거나 작업을 할 수 없습니다.
새 메시지 0개