Skip to content

Latest commit

 

History

History
54 lines (43 loc) · 1.64 KB

readme.md

File metadata and controls

54 lines (43 loc) · 1.64 KB

PrintCoverage

PrintCoverage plugin allows you easily integrate coverage badge into your Azure DevOps pull requests!

Build Status License: MIT

How to use

In the module build.gradle:

plugins {
    id('com.intermedia.printcoverage').version('0.0.2')
}

import com.intermedia.printcoverage.azure.AzurePrinterFactory
import com.intermedia.printcoverage.azure.AzureRepo

printCoverage {
    setPrinterFactory(
            new AzurePrinterFactory(
                    new AzureRepo(
                            "<azure token>",
                            "<azure base url>",
                            "<azure organization>" ,
                            "<azure project>",
                            "<azure repo>"
                    )
            )
    )
    setJacocoReportFile(file("${project.buildDir}/outputs/jacoco/report.xml"))
}

Where azure token is a personal access token with custom scopes:

  • Code (Status)
  • Code (Read & Write)

And then run it in the Azure pipeline as a policy for a target branch:

./gradlew testDebugUnitTest printCoverage

How it works

The plugin processes the jacoco report xml file, analyzes the test coverage stat, and then posts it via Azure DevOps api as a pull request status update.