本文介绍了如何让scalatest通过sbt生成html报告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 sbt 中对基于 specs2 的测试执行此操作的方法是

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

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

但是 Scalatest 怎么样?我在 Google 上搜索了很多,但找不到好的解释/解决方案.

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 (排除规则(组织=org.junit",名称=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")

这篇关于如何让scalatest通过sbt生成html报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-07 11:11