Skip to content

Java Code Coverage

Code Quality enables users to include coverage data as part of the analysis for Java projects. However, Code Quality itself does not generate coverage reports. To incorporate coverage information, users must first use a third-party tool to create the coverage report. Once the report is ready, users need to configure Code Quality to locate and retrieve it. This ensures that the coverage data is displayed alongside other analysis results within the Code Quality UI.

Full Workflow Example

End-to-End Configuration in Azure Repository

Pre-requisites:

  • The Code Quality (Embold) Server must be running and properly configured.
  • The user needs to have a build for their Java project, which includes JaCoCo coverage data as part of the test runs.
  • The user should run the Code Quality (Embold) scan on the same host where the Java project was built and the JaCoCo data was generated.
  • The reports should be in XML format.

Running Remote Scan for Coverage

To include JaCoCo coverage data in your analysis, run a remote scan using the CLI scanner. Full setup and execution instructions are in the Remote Scan (CLI Analysis) guide.

Coverage-specific config: In your repository-configuration.json, the jacoco module is enabled by default. Set the reportDir value to the parent directory of your JaCoCo XML report(s).

Once the scan completes, navigate to the Coverage section in the Code Quality UI to view the results.

Running Coverage in CI/CD

To automate coverage analysis as part of your pipeline (GitHub Actions, Azure DevOps, Jenkins, GitLab CI, etc.), see the CI/CD Integration guide.