Keep-Going-Web-Study / BE-Spring-Test-Guide

인프런 강의를 중심으로 Spring 테스트에 대해 학습합니다.
0 stars 0 forks source link

[Question] Persistence Layer의 테스트 코드 커버리지를 다들 어떻게 계산하시나요? #13

Open JadeKim042386 opened 4 days ago

JadeKim042386 commented 4 days ago

질문 내용

Jpa Repository의 경우 인터페이스 클래스에 쿼리 메소드를 추가하여 사용하는데요. JaCoCo의 경우 인터페이스에 정의한 메소드는 커버리지를 계산하지 않는 것 같습니다. 그래서 Persistence Layer(Jpa Repository)의 커버리지를 계산하는 방법에 대해서 고민하고 있는데요. 방법을 알고 계시다면 공유해주실 수 있을까요?

참고한 자료(선택)

eod940 commented 4 days ago

저는 아직 유의미하게 테스트 커버리지를 구해본 적이 없습니다.😢 그래서 별도의 방법을 알지는 못하는데요, 관련해서 검색해보니 JaCoCo가 인터페이스를 커버하지 않는 이유를 답변해준 글이 있어서 공유드립니다.

This is also explained in JaCoCo FAQ:

Why are abstract methods not shown in coverage reports?

Abstract methods do not contain code, therefore code coverage cannot be evaluated. Indeed code coverage is recorded for subclasses implementing these methods. The same applies to non-default methods in interfaces.

Jacoco doesn't detect interfaces, 20240625 20:43 확인