コードカバレッジレポートの生成と、プロジェクトコードをカバーする単体テストの分析の取得に問題があります。Sonarを使用してプロジェクトのレポートを取得しましたが、ユニットテストカバレッジセクションには何も表示されません。私はいくつかの調査を行ったところ、ソナーにはemma / clover / corbetura / jacocoによって生成されたjunitレポートが必要であることがわかりました。このプロジェクトはMavenベースではありません。非Mavenベースのマルチモジュールプロジェクトのコードカバレッジを分析する方法を教えてください。ソナーランナーを使用しています。
リンクやリファレンスが役立ちます。ドキュメントページのリンクを提供しないでください。どうやら、私はそれらすべてを閲覧しました。前もって感謝します。
ドキュメントや例を見たことがない人を助けるために、ドキュメントページへのリンクを提供しています。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
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加