Hi, Thank you for your answer.
I'm using JaCoCo in a Maven project. I have all my test files in src/test/java. When I'm using surefire to run a command like `mvn -Dtest=testClass#testMethod", I will get the JaCoCo report in target/site/jacoco. So, since you say that in maven, the JaCoCo only considers code in src/main/java, is it possible to modify the code or do the other things to make it possible to evaluate the code in src/test/java? 在2022年8月11日星期四 UTC+8 23:01:03<Marc R. Hoffmann> 写道: > Hi, > > JaCoCo as such is framework agnostic and calculates coverage for all Java > classes executed in a VM. > > Specific integrations only consider certain parts of your code (e.g. Maven > only src/main/java). > > How do you create your coverage report? > > Regards, > -marc > > > On 11. Aug 2022, at 08:15, Xiang Liao <[email protected]> wrote: > > Hi, > Jacoco seems only to have a coverage report for the main classes. What if > I want to get the coverage report for the tests? > For example, if I have a Test Class > public class ExampleTest { > @Test > public void test1() { > new Example().doSomething(1); > } > and a Main Class > public Class Example{ > public void doSomething(int p){ > ... > } > } > Of course, the report will contain the coverage in Example.java, but it > doesn't show the coverage in ExampleTest.java even though I ran this test. > Can I get it through Jacoco? > > -- > 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/554f128f-3264-4c3c-967c-6d27786f49a1n%40googlegroups.com > > <https://groups.google.com/d/msgid/jacoco/554f128f-3264-4c3c-967c-6d27786f49a1n%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/c77a0932-c196-4c7b-a908-867de87dc1d3n%40googlegroups.com.
