2014-02-19 2 views
0

코드 커버리지 보고서를 생성하고 프로젝트 코드를 다루는 단위 테스트 분석에 문제가 있습니다. Sonar를 사용하여 프로젝트에 대한 보고서를 얻었으나 단위 테스트 커버리지 섹션에는 아무 것도 표시되지 않습니다. 나는 약간의 조사를했고 소나가 emma/clover/corbetura/jacoco에 의해 생성 된 junit 보고서를 가지고 있어야한다는 것을 알았습니다. 이 프로젝트는 non-maven 기반입니다. non-maven 기반의 다중 모듈 프로젝트에 대한 코드 커버리지를 어떻게 분석 할 수 있는지 말해주십시오. 나는 소나 러너를 사용하고있다.다중 모듈 프로젝트의 적용 범위 보고서

모든 링크 또는 참조가 도움이 될 것입니다. 문서 페이지 링크를 제공하지 마십시오. 분명히, 나는 그들을 모두 찾아 보았습니다. 미리 감사드립니다.

답변

1

문서 나 예제를 보지 못한 다른 사람들을 돕기 위해 설명서 페이지에 대한 링크를 제공하고 있습니다. Maven 속성 설정을 가져 와서 sonar-runner.properties로 변환합니다. 예를 들어, 멀티 모듈 프로젝트를 설정하는 방법에 따라 당신은 상위 수준에서이 설정을 넣을 수도 있고, 각 모듈 내부 :

: 여기

sonar.jacoco.reportPath=reports/coverage/jacoco.exec은 멀티 모듈 소나 러너 프로젝트에 대한 링크입니다 http://docs.codehaus.org/display/SONAR/Analyzing+with+SonarQube+Runner

단위 테스트 코드 범위를 구성하려면 maven의 동일한 등록 정보를 sonar-project.properties 파일에 적용하십시오. 여기에 코드 커버리지 예제의 예는 다음과 같습니다

https://github.com/SonarSource/sonar-examples/tree/master/projects/code-coverage

참고하면 기기와 범위 속성뿐만 아니라 소스 인코딩 속성을 설정해야합니다.

멀티 모듈 프로젝트에 대한

    sonar.projectKey=org.codehaus.sonar:example-ut-sonarRunner-jacoco-reuseReports 
    sonar.projectName=UT coverage with SonarQube Runner reusing JUnit and JaCoCo reports 
    sonar.projectVersion=1.0 

    sonar.sources=src 
    sonar.binaries=classes 
    sonar.language=java 

    # Tells SonarQube to reuse existing reports for unit tests execution and coverage reports 
    sonar.dynamicAnalysis=reuseReports 

    # Tells SonarQube where the unit tests execution reports are 
    sonar.junit.reportsPath=reports/junit 

    # Tells SonarQube that the code coverage tool by unit tests is JaCoCo 
    sonar.java.coveragePlugin=jacoco 

    # Tells SonarQube where the unit tests code coverage report is 
    sonar.jacoco.reportPath=reports/coverage/jacoco.exec 

    # Encoding of the source files 
    sonar.sourceEncoding=UTF-8 
+0

하면 내가 가지고있는 다음과 같은 설정 : 'sonar.sources = SRC1, SRC2, SRC3 sonar.binaries = classes1, classes2, classes3 sonar.binaries = classes1, classes2, classes3' 나를 위해 src1에 대한 테스트 결과와 적용 범위 만 보여줍니다. 'sonar.dynamicAnalysis = reuseReports'를 지정해도 도움이되지 않았습니다. – divanov

관련 문제