How to make scalatest generate html report via sbt

The way to do this for specs2 based test in sbt is

(testOptions in Test) += Tests.Argument(TestFrameworks.Specs2, "html") 

but what about scalatest? I have done a lot of google searches but cannot find a good explanation / solution.

+7
scala sbt scalatest specs2
source share
2 answers

so i need to do two things ...

I. use any scalar artifact after 2.0.M5b. For me, I added this dependency,

org.scalatest" %% "scalatest" % "2.0.M6" % "test->*" excludeAll ( ExclusionRule(organization="org.junit", name="junit") )

"test → *" is necessary, otherwise the dependencies needed to generate html will not be loaded. (There must be a better way than this)

II. In build.sbt add

(testOptions in Test) += Tests.Argument(TestFrameworks.ScalaTest, "-u", "target/report")

+9
source share

beware of this setting.

org.scalatest "%%" scalatest "%" 2.0.M6 "%" test → *

He pulls out some junit: junit: 3.8.1 a dependency that ivy cannot solve. see this error

this is the best way to do it in ScalaTest 2.0

 testOptions in Test += Tests.Argument(TestFrameworks.ScalaTest, "-u", "target/test-reports") 

This works well in Jenkins

+3
source share

All Articles