问题描述
在 sbt 中进行基于 specs2 的测试的方法是
The way to do this for specs2 based test in sbt is
(testOptions in Test) += Tests.Argument(TestFrameworks.Specs2, "html")
但是 scalatest 怎么样?我做了很多谷歌搜索,但找不到好的解释/解决方案.
but how about scalatest? I've done lots of Google search, but cannot find a good explanation/solution.
推荐答案
所以我需要做两件事...
so two things I need to do...
我.使用 2.0.M5b 之后的任何 scalatest 工件.对我来说,我添加了这个依赖项,
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->*" 是必需的,否则将不会下载生成 html 所需的依赖项.(一定有比这更好的办法)
"test->*" is necessary, otherwise dependencies needed to generate the html wont be downloaded. (There must be a better way than this)
二.在 build.sbt 中添加
II. In build.sbt, add
(TestOptions in Test) += Tests.Argument(TestFrameworks.ScalaTest, "-u", "target/report")
这篇关于如何通过 sbt 使 scalatest 生成 html 报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!