Integrating Scala Code Coverage Tool (SCCT) in Play Scala project

In my last blog i’ve elaborated the steps to integrate the JaCoCo with your Play Scala project. This time we’ll learn about how to integrate the Scala Code Coverage Tool ( SCCT ) in your Play Scala project.

Just some easy steps and you’re done with SCCT integration. Lets see it in action.

1. Add the following resolvers in your plugin.sbt file.

resolvers += Classpaths.typesafeResolver

resolvers += "scct-github-repository" at ""

2. Add this sbt plugin there as well.

addSbtPlugin("reaktor" % "sbt-scct" % "0.2-SNAPSHOT")

3 . Define a lazy val for SCCT settings in your Build.scala & include the settings as below :

  lazy val scct_settings = Defaults.defaultSettings ++ Seq(ScctPlugin.instrumentSettings: _*)

  val main = PlayProject(appName, appVersion, appDependencies, mainLang = SCALA,settings = scct_settings).settings( 
  testOptions in Test := Nil


4. We have a model object Hello.scala in app/models & its corresponding test HelloTest.scala in test/models

5. After adding these just do :

play clean compile eclipsify run

6. Now its time to have the coverage report for our tests. Run scct:test as shown below
SCCT Test Coverage

7. You’d find the test coverage report for you project in /target/scala-2.9.1/coverage-report/index.html .

Note : Open the index.html file with Firefox browser.

8. Here’s our test coverage report :
SCCT Test Coverage Report

Find the code here on Github

About Neelkanth Sachdeva

Project Manager @ eCIFM Solutions Inc. Previous : Senior Software Engineer @ Evernym Inc. Previous : Software Consultant @ Knoldus Software LLP Software Consultant @ Inphina Technologies
This entry was posted in Scala, Web and tagged , , , . Bookmark the permalink.

3 Responses to Integrating Scala Code Coverage Tool (SCCT) in Play Scala project

  1. pavan says:

    Good information provided regarding Scala tool.. thanx!

  2. Pingback: Building Quality into Scala Development | Knoldus

  3. thetrav says:

    why a lazy val rather than a normal val?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s