Interview Prep/CI/CD/Builds, Artifacts, Nexus, SonarQube and Testing

Coverage shows 0% in SonarQube although tests run in CI.

IntermediateScenarioBuilds, Artifacts, Nexus, SonarQube and Testing
Answer

Situation read → The scanner cannot find the coverage report.

What I'd do →

  1. Generate the report before the scan (JaCoCo XML, lcov.info, coverage.xml).
  2. Pass its path: -Dsonar.coverage.jacoco.xmlReportPaths=target/site/jacoco/jacoco.xml or -Dsonar.javascript.lcov.reportPaths=coverage/lcov.info.
  3. Make sure the scanner runs in the same workspace after tests and with matching source paths.

Why → SonarQube imports coverage; it does not compute it.

Interview tip → Path mismatches inside containers are the common cause.

All CI/CD questions Roadmap: CI/CD fundamentals

More on Builds, Artifacts, Nexus, SonarQube and Testing