Saturday, March 3, 2012

Unit Testing- Scala Code Coverage Tool - SCCT Windows 7


Credit goes to the original publishers...
http://mtkopone.github.com/scct/
I modified or organized the original content...

After Creating a New Project now its time for the Code Coverage Analysis setup using the SCCT. All the instructions about the SCCT setup were given by the original publisher. I would like to give you a detailed step level setup explanation which makes your path easy for setup.
Set up for SCCT tool.
1. Add the following code to (In my case) C:\Users\anil\anil\project\plugins\Plugins.scala


import sbt._
class Plugins(info: ProjectInfo) extends PluginDefinition(info) {
  val scctRepo = "scct-repo" at "http://mtkopone.github.com/scct/maven-repo/"
 lazy val scctPlugin = "reaktor" % "sbt-scct-for-2.8" % "0.1-SNAPSHOT"
}  


2. Project definition(Inmycase)  C:\Users\anil\anil\project\build\AnilFirstProject.scala , should extent reaktor.scct.ScctProject


import sbt._
import reaktor.scct.ScctProject
class HelloAnilProject(info: ProjectInfo) extends DefaultProject(info) with ScctProject
{
lazy val hi=task {println("This is Anils First New Project"); None}
}


3. Enter in to the project directory (In my case) c:\Users\anil\anil\
4. Type sbt and press enter
5. Type reload and press enter (necessary only when code is changed or some new files added)
6. Type update and  press enter(only when code is changed or some new files added)
7. Type test-coverage and press enter.
if everything goes fine you see below output
8. To check the test output open /target/scala_2.9.1/coverage-report/index.html

enjoy.....






No comments:

Post a Comment