Scoverage Analysis | Scala | SBT

Reading Time: 3 minutes

Scoverage… what it is, how to use it and for which build tool it is available. So, In this blog we are gonna discussing all these along with its implementation in SBT.

What is scoverage ?

“scoverage” is an Apache’s free licensed code coverage tool for Scala language that put forward the statement and branch coverage. It is available for SBT, Maven, and Gradle.

Advantage of scoverage –

  • It is very powerful and useful tool, used to test untested parts of code.
  • It’s report helps in finding areas of a program which are not tested by set of test cases
  • Thus , indirectly it checks the quality of product.

Workflow –


1. Build –

scoverage starts with Build Tool being used. So, before using this coverage tool (scoverage), you have to add the plugin in your project.

Add the following line in the “plugins.sbt” in project folder parallel to “”.

Scoverage Plugin

Hence a plugin will be added to your project.

2. Code Coverage –

Code coverage deals with investigating the tested and untested part of code. In order to do that you’ve to run certain commands in your terminal.

So, after getting done with the coding (main & test) run the following commands.


Make sure you’ll be getting a [Success] message after executing the above command.

Now, Generate your report using the following command.


Consequently, You’ll seeing an Output unveiling the Statement coverage, Branch Coverage. The Output will be identical with the below Output.

Scoverage Result

As, everything is pretty clear in the above Image. The Coverage of code is [97.65%].

3. Result Analysis –

Result Analysis is nothing just looking up the code. Inspecting which part of code is getting covered with the test cases. A number of tools are available such as “sonarqube” ( an open source platform) to analyse the result. But for now you can check it by looking into the html file. And the path to the HTML file is in the report itself. Let’s check the following report.

Scoverage Report

References –

Written by 

Kuldeepak Gupta is a passionate software consultant at Knoldus Inc. Knoldus does niche Reactive and Big Data product development on Scala, Spark, and Functional Java. His current passions include utilizing the power of Scala, Akka, and Play to make Reactive and Big Data systems. He is a self-motivated, enthusiastic person who is recognized as a good team player, dedicated, responsible professional, and a technology enthusiast. His hobbies include playing hockey, participating in Political debates, Reading Tech blogs, and listening to songs.