Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

Jacoco coverage report has 0 coverage, although junit tests run with 100% coverage

anjali_biddanda
Level 4
Level 4

Hi Everyone,

 

I have a workflow process class and a junit test class for it. Junit tests run successfully. However, Jacoco reports 0% coverage. It seems to ignore this class because of the annotation:

@RunWith(MockitoJUnitRunner.class)

 I'd like to use the new @ExtendWith(MockitoExtension.class), but I'm not successful in getting the tests to run successfully. I haven't seen an example of this Junit5 notation used for Workflow processes. There are recent unit test examples for workflow processes here: https://github.com/Adobe-Consulting-Services/acs-aem-commons/blob/master/bundle/src/test/java/com/ad... , but that's using the Junit 4 too.

 

Any help with how to get Jacoco to pick up this notation.

 

Thanks.

 

 

1 Accepted Solution
anjali_biddanda
Correct answer by
Level 4
Level 4

Hi guys, I changed the junit4 syntax (@RunWith(MockitoJUnitRunner.class)) to use @ExtendWith(MockitoExtension.class) and this fixes it. Jacoco doesn't understand the old syntax.

View solution in original post

4 Replies
anjali_biddanda
Correct answer by
Level 4
Level 4

Hi guys, I changed the junit4 syntax (@RunWith(MockitoJUnitRunner.class)) to use @ExtendWith(MockitoExtension.class) and this fixes it. Jacoco doesn't understand the old syntax.

View solution in original post

Manjunath_K
Community Advisor
Community Advisor

@anjali_biddanda 

Even i am using JUnit5 @ExtendWith & able to generate Jacoco report using the same. are you still facing any issue after changing it to  JUnit5 @ExtendWith ?

 

- Manjunath

kautuk_sahni
Community Manager
Community Manager
Thanks for sharing the fix. This would help in posterity.