How to tell SonarQube to get the coverage report from specified project directory

Hi all,

I’m very new to SonarQube and I’ve no experience working on SonarQube application.

In our organization, we are using SonarQube for code quality checks and etc.

I have one project which is already configured with our organization’s SonarQube and I’ve given one task to unit test my application. I’ve unit tested my application and generated the coverage report using an npm package called jest-sonar-reporter

My project is built using React and Django and the project’s structure kinda looks like this.

    - build/
    - coverage/
    - node_modules/
    - src/
    - package.json
    - package.lock.json
    - sonarTestResults/
        -  sonarqube-codecoverage-report.xml

So now how can I tell SonarQube to pick the sonarqube-codecoverage-report.xml coverage report which is in ReactDirectory/sonarTestResults/sonarqube-codecoverage-report.xml and show the appropriate metrics result for code coverage for the project in the SonarQube dashboard?

Please, someone, advise/help me with this.

Thank you in advance


Welcome to the community!

You’ll need to pass the path-from-project-root as the argument to the correct analysis parameter. The docs on the scanner you’re using should tell you how.


Hi @ganncamp, thank you for your response.

Actually, we’re using Jenkins to build the project, I’m really not sure where to give this file path as the analysis parameter.

Thank you


Depending on how you’re doing this in Jenkins, you can pass it on the analysis command line or add it in the field for arguments in the analysis step.


stage('SonarQubeScan') {
        steps {
            withSonarQubeEnv('SonarQube') {
                withCredentials([string(credentialsId: 'sq_prd_token', variable: 'SONAR_TOKEN')]) {
                    sh "source ~/.bash_profile;which sonar-scanner;sonar-scanner \
                        -Dsonar.sources=$WORKSPACE \
                        -Dsonar.login=$SONAR_TOKEN \
                        -Dsonar.sonar.javascript.lcov.reportPaths=<path to report>"

This is one stage in Jenkinsfile. in this, I’ve added like sonar.sonar.javascript.lcov.reportPaths=<path to report>

So the path should be the relative or absolute path? I’ve given the relative path and the coverage file is not detecting I feel because in the SonarQube dashboard coverage % is still 0.


Your <path to report> is typically going to be relative to project root (which is presumably where analysis is running from). What to share the relevant log lines where it’s not finding your report?


Hi Ann,

sorry for the delayed response! Our organization had not given admin privileges to the project. So once that getting done I’m able to see the administration tab and could relate to what you were trying to say.

But for the react project I have generated the generic code coverage report. This stackoverflow question I have followed to generate the generic coverage report (

But in the admin settings, I was not able to find the testExecutionReportPaths field to add the path of the generic code coverage report.

Could you please help me with this?


You won’t find that in the interface; it’s only settable via analysis parameters.


Can you please tell me where and how can I set that? an example would definitely help me.


Hi Aashay,

You can add this to your analysis parameters (in your Maven pom if you have one or in your file) or on the analysis command line with -Dsonar.testExecutionReportPaths=[relative path from project root]


Hi Ann,

Thank you for your response. I have created the file in the project root. In that, I added the sonar.testExecutionReportPaths=<project-path>/react-coverage-report.xml

Also, I have other properties where everything is working fine, but testExecutionReportPaths isn’t! :frowning:

Someone had already asked the similar question on stackoverflow


How are you providing those properties to analysis?


Hi Ann,

I have created a file in the project root and in that I have provided the analysis parameters.

I have Django code coverage report which is being shown in the SonarQube dashboard and also it’s showing the appropriate project name in SonarQube which is defined in file. So I’m assuming that SonarQube is able to pick But I’m not sure why sonar.testExecutionReportPaths is not working

Below is how the look like.


sonar.projectName=Project Name




sonar.test.inclusions=**/*.test.js, */tests/*.py




Could you share your analysis logs?