how to make scalatest generate html report through sbt

你。 提交于 2020-01-01 02:51:12

问题


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

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

but how about scalatest? I've done lots of Google search, but cannot find a good explanation/solution.


回答1:


so two things I need to do...

I. use any scalatest 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 dependencies needed to generate the html wont be downloaded. (There must be a better way than this)

II. In build.sbt, add

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




回答2:


beware with that setting.

org.scalatest" %% "scalatest" % "2.0.M6" % "test->*

It pulls out some junit:junit:3.8.1 dependency which ivy fails to resolve. see this bug

this is a better way to do it in ScalaTest 2.0

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

This works well in Jenkins



来源:https://stackoverflow.com/questions/18724680/how-to-make-scalatest-generate-html-report-through-sbt

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!