On Wednesday, October 4, 2017 at 6:33:22 PM UTC+2, Evgeny Mandrikov wrote: > > > I managed to prepare an example of my case and pinpoint the issue. >> https://github.com/juzer/spring-jacoco-demo >> It seems to be related to the inheritance hierarchy and abstract classes. >> I have an AbstractService which is tested by instantiating an anonymous >> class and it's covered 100%. Then I have a concrete subclass that is also >> tested (only methods in this class). When I run all the tests however, the >> coverage of AbstractService is 0. Moving all tests to the ServiceTest >> results in correct coverage report - 100% on both classes. >> > > I'll have a look later. > > Execution of
mvn clean test produces Running com.example.demo.ServiceTest Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.154 sec - in com.example.demo.ServiceTest i.e. AbstractServiceTest is not executed!! hence not covered as expected. BTW addition of debug output allows to easily pinpoint if code is really executed. According to https://stackoverflow.com/questions/25813941/spring-boot-my-unit-tests-are-being-skipped : "Spring Boot configures the Surefire plugin to run all test classes that have a name ending with Test or Tests but *not starting with Abstract*." After renaming into "MyAbstractServiceTest": <https://lh3.googleusercontent.com/-8v5b3-IQEH8/WdUSoQed9nI/AAAAAAAAB3Y/gURp1uPFJGkVxLHkApO-RnLklp5I5QqCgCLcBGAs/s1600/coverage.png> Regards, Evgeny -- 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/db0494d6-694d-4de9-9508-3da6646bbde6%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
