Scala 集成测试 "No such setting/task"

scala integration tests "No such setting/task"

集成测试配置对我来说是新的。

我无法对 运行(在 sbt 或 intellij 上)进行最大规模的集成测试。

我的单元测试 src/test/scala 运行 很好。

我的集成测试在 src/it/scala

如果我 运行 和 sbt it:test 错误是 "No such setting/task"

如果我在 intellij 上 运行(即使用 'run' 按钮),我得到

Unable to load a Suite class. This could be due to an error in your runpath. Missing class: xxx.tools.es_ingester.EsIntegrationSpec
java.lang.ClassNotFoundException: xxx.tools.es_ingester.ConfluenceEsIntegrationSpec
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)

然而class显然是在/src/it/scala/xxx/tools/es_ingester.

更新:build.sbt

name := "xxx.tools.data_extractor"

version := "0.1"

organization := "xxx.tools"

scalaVersion := "2.11.12"

sbtVersion := "1.2.7"

libraryDependencies += "org.scalactic" %% "scalactic" % "3.0.5"
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.5" % "test"
libraryDependencies += "com.fasterxml.jackson.module" %% "jackson-module-scala" % "2.9.5"
libraryDependencies += "ch.qos.logback" % "logback-core" % "1.2.3"
libraryDependencies += "org.slf4j" % "slf4j-api" % "1.7.25"
libraryDependencies += "ch.qos.logback" % "logback-classic" % "1.2.3"
libraryDependencies += "org.apache.logging.log4j" % "log4j-core" % "2.11.2"
libraryDependencies += "commons-io" % "commons-io" % "2.6"
libraryDependencies += "org.bouncycastle" % "bcprov-jdk15on" % "1.61"
libraryDependencies += "org.mockito" % "mockito-core" % "2.24.0" % Test
libraryDependencies += "com.typesafe" % "config" % "1.3.3"
libraryDependencies += "com.typesafe.play" %% "play" % "2.7.0"
libraryDependencies += "org.elasticsearch.client" % "elasticsearch-rest-client" % "6.6.0"
libraryDependencies += "org.elasticsearch" % "elasticsearch" % "6.6.0"
libraryDependencies += "org.elasticsearch.client" % "elasticsearch-rest-high-level-client" % "6.6.0"
libraryDependencies += "org.jsoup" % "jsoup" % "1.11.3"

您还没有为集成测试添加配置。

例如在scala测试或默认设置中添加it

"org.scalatest" %% "scalatest" % "3.0.5" % "it, test" 

对于所有集成,设置 refer

希望对您有所帮助。