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.

2. Add this sbt plugin there as well.

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

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 :

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

3 thoughts on “Integrating Scala Code Coverage Tool (SCCT) in Play Scala project

Leave a Reply

%d bloggers like this: