sqality / scct   0.2

Apache License 2.0 GitHub

Scala Code Coverage Tool

Scala versions: 2.10

A new fork of SCCT has been released as Scoverage

  • Scoverage provides statement level coverage whereas SCCT provides line level coverage

Scala Code Coverage Tool Build Status Coverage Status

Available on sonatype oss and maven central repository.

Join the SCCT google group for help, bug reports, feature requests, and general discussion on SCCT.

What does it look like ?

Scala versions

0.3.0 is built against Scala 2.10, 2.11

0.2.2 is built against Scala 2.9.2

Install

Add the plugin to your build with the following in project/plugins.sbt:

addSbtPlugin("com.sqality.scct" % "sbt-scct" % "0.3")

Or you can use the last Snapshot instead

resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots"
addSbtPlugin("com.sqality.scct" % "sbt-scct" % "0.3.1-SNAPSHOT")

Add the plugin settings to your project, at build.sbt:

ScctPlugin.instrumentSettings

Run your unit tests :

$ sbt clean scct:test

Then open:

./target/scala-2.10/coverage-report/index.html

Multiproject builds

Add the plugin instrumentation settings to child projects and the report merging settings to the parent project.
For example project/MyBuild.scala:

object MyBuild extends Build {
  lazy val root = Project(id = "parent", base = file("."))
      settings (ScctPlugin.mergeReportSettings: _*) aggregate(first, second)

  lazy val firstChild = Project(id = "firstchild", base = file("first"))
      settings (ScctPlugin.instrumentSettings: _*)

  lazy val secondChild = Project(id = "secondchild", base = file("second"))
      settings (ScctPlugin.instrumentSettings: _*)
}

Run coverage for all child projects with:

$ sbt clean scct:test

This creates individual coverage reports into $childProjectDir/target/scala*/coverage-report/
Merge all the existing child reports into $parentProjectDir/target/scala*/coverage-report/ with:

$ sbt scct-merge-report

Integrations

Learn More

License

This software is licensed under the Apache 2 license, quoted below.

Copyright 2013 SCCT(http://sqality.com).

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this project except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.