Azure Devops Pipeline: Code coverage Report for Spring boot using Jacoco

Minimise gap between defect insertion and defect detection

  • Unit Test
  • Assertions
  • Formal code inspection
  • Pair Programming
  • Single Stepping through debugging

Maven configuration

Maven goal to run the test

  • In spring boot project, add spring boot test starter.

Azure Pipeline configuration

  1. Task to run the tests — task: Maven@3
  2. Task to publish the test results — PublishTestResults@2
  3. Task to publish the code coverage — PublishCodeCoverageResults@1
# azure-pipelines.yml
- stage: Build
displayName: Build stage
- job: CodeCoverage
displayName: Code Coverage
vmImage: "ubuntu-16.04"
- task: Maven@3
displayName: "Maven Test"
mavenPomFile: "pom.xml"
goals: "test"
- task: PublishTestResults@2
displayName: "Publish test results"
testResultsFormat: "JUnit"
mergeTestResults: true # Optional
- task: PublishCodeCoverageResults@1
displayName: "Publish publish code coverage"
summaryFileLocation: $(System.DefaultWorkingDirectory)/target/site/jacoco/jacoco.xml
pathToSources: $(System.DefaultWorkingDirectory)/src/main/java/



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Deepan Kumar Manivannan

Deepan Kumar Manivannan


“The future belongs to those who learn more skills and combine them in creative ways.” ― Robert Greene, Mastery