implement and Generate Code coverage for sbt project - saviovettoor/DevOps-wiki GitHub Wiki

Configuration

  • Add plugin to your project Plugins.sbt file

//code coverage report generation
addSbtPlugin("com.github.sbt" % "sbt-jacoco" % "3.0.3")
  • Configure report format in your main Build.sbt

 //Add the below line in common settings so that its available to all sub-projects
 jacocoReportSettings := JacocoReportSettings().withFormats(JacocoReportFormats.XML, JacocoReportFormats.HTML)

Generate the report

  • To generate the report run

 Type in your sbt shell > jacoco
  • For individual sub-project

 project-name/jacoco like we have sub-projects then run report only on a module we can say core/jacoco
  • The current config supplied (the one which needs to be added into build.sbt) will generate report both in XML and HTML format.

Use html format to view the coverage for the concerned code snippet.
⚠️ **GitHub.com Fallback** ⚠️