Run scoverage from intellij - scala

I was wondering, is it possible to run scoverage from intellij (not from the terminal ) and even better, see scoverage reports like the native coverage from intellij?
Thanks

I've managed to collect coverage by adding scalac-scoverage-plugin as a test dependency:
libraryDependencies += "org.scoverage" %% "scalac-scoverage-plugin" % "1.4.0" % Test

Related

How to break the build if test coverage fails minimum threshold?

We want to fail the build on codeship if test coverage goes below the threshold value. But it is not failing the build.
Scoverage Plugin:
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.3.5")
Added following two statements in build.sbt
coverageMinimum := 80,
coverageFailOnMinimum := true
It is not failing even in local if test coverage is below 80. The command I run is
sbt clean coverage test coverageReport
Try upgrading to version 1.5.1 like so
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.1")

Issues with using Scoverage: Scala Sbt

I added the scoverage plugin to projects/plugins.sbt
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.3.5")
I was able to generate test coverage using
sbt clean coverage test
sbt coveragereport
However when I try to add socverage config to my build.sbt. I see build errors
error: value ScoverageKeys is not a member of object scoverage.ScoverageSbtPlugin
ScoverageSbtPlugin.ScoverageKeys.coverageMinimum := 70
Looks like build.sbt does not find Scoverage classes. What is going on here?
check that out. Seems like what you need is:
scoverage.ScoverageKeys.coverageMinimum := 70

Where to place downloaded ScalaTest jar so sbt uses it across projects?

I've downloaded the ScalaTest jar and have used it as in the example, but now I would like to start using it with sbt. Where do I place the downloaded jar so I can use it with sbt across multiple projects?
You don't download dependencies like ScalaTest manually. The point of using sbt is to declare your project's dependencies and let sbt download them for you automatically.
Add this line in your build.sbt file:
libraryDependencies += "org.scalatest" %% "scalatest" % "2.2.0" % "test"
For more details see official doc on setting this up.

How do I declare SBT dependencies withSources that have test scope in published pom file?

When attempting to publish:
https://github.com/thetrav/http-stub-server-scala/blob/master/project/build.scala
The test framework dependencies are leaking into the runtime dependencies.
I've narrowed it down to the line:
"org.scalatest" %% "scalatest" % "2.0.M5b" % "test" withSources(),
The problem appears to be withSources() which does not get published with the test scope
Is there a way for me to get the sources in test and dev, but not in the runtime?
withSources is not recommended in sbt 0.10+. The IDE plugins use updateClassifiers, for example, and this can be used by other tasks/plugins that do similar things.

How to run scala specs 2 in eclipse

How to run scala specs 2 in eclipse (scala-ide)?
My steps were:
sbt eclipse - generate eclipse project from existing source
eclise: import project - open project in eclipse ide
Put break-point in my SPECS 2 test (class MyTest extends Specification { ... )
Try to run test ...? (usually I do it in IntelliJ IDEA.. but today going to check how eclipse works with debug in scala..)
At the moment, you can use a little hack. If you annotate your Specs2 class as follows:
#RunWith(classOf[JUnitRunner])
With older versions of specs2, this should be:
#RunWith(classOf[JUnitSuiteRunner])
The Scala IDE can run it with the JUnit runner simply through the popup menu (see the details here).
I'm working on a Specs2 plug-in for the Scala IDE (well, unfortunately I haven't really found time for it for a while, but it's still on my list).
It has a working version for the previous version of the Scala IDE, it is a bit difficult to set it up but works. See the details here: http://rlegendi.github.io/specs2-runner/
I had to make sure the build.sbt file included the following information:
scalacOptions in Test ++= Seq("-Yrangepos")
"org.specs2" %% "specs2-core" % "3.6.5" % "test",
"org.specs2" %% "specs2-junit" % "3.6.5" % "test",