【发布时间】:2022-01-08 19:26:00
【问题描述】:
我是 scala 的新手, junit 测试用例没有在集成测试中运行。
文件夹结构
src
|- it
|- main
|- test
当我执行sbt test 时,“test”文件夹中的所有测试用例都执行得很好,
但是当我这样做时it:test
[error] No such setting/task
[error] it:test
[error]
it 文件夹包含 Tester.scala
package RegexExtractor
import org.junit.Assert.assertTrue
import org.junit.Test
class Tester {
@Test
def testAdd1(): Unit = {
val result = 2 + 4
assertTrue(result == 6)
System.out.println("Test final Passed")
}
}
}
我在 build.sbt 中添加了
lazy val scalatest = "org.scalatest" %% "scalatest" % "3.0.5"
lazy val root = (project in file("."))
.configs(IntegrationTest)
.settings(
Defaults.itSettings,
libraryDependencies += scalatest % "it,test",
// other settings here
)
请帮我运行集成测试
【问题讨论】:
标签: java scala junit sbt integration-testing