Code Coverage

After they’re done running, builds can display code coverage percentage in the build UI and upload code coverage data.

Coverage in build detail page

We currently support SonarQube for coverage bookends. Check with your Screwdriver cluster admin to find what coverage plugins are supported to modify your build execution with.

SonarQube

You can configure Sonar properties in your sonar-project.properties file or in your screwdriver.yaml as an environment variable. The property sonar.sources is always required, and should be set to your source path.

sonar-project.properties

To use SonarQube, add a sonar-project.properties file in the root of your source code and add configurations there.

Example sonar-project.properties file from our Javascript example:

sonar.sources=lib
sonar.javascript.lcov.reportPath=artifacts/coverage/lcov.info

The reportPath property depends on the language used. Check the SonarQube documentation to figure out the right syntax.

$SD_SONAR_OPTS

Alternatively, you can add configurations to the environment variable $SD_SONAR_OPTS.

Example screwdriver.yaml:

shared:
    environment:
        SD_SONAR_OPTS: '-Dsonar.sources=lib -Dsonar.sourceEncoding=UTF-8'
jobs:
    main:
        requires: [~pr, ~commit]
        image: node:8
        steps:
            - echo: echo hi

Notes