【问题标题】:scala integration tests "No such setting/task"scala集成测试“没有这样的设置/任务”
【发布时间】:2019-07-16 01:21:19
【问题描述】:

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

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

src/test/scala 中的单元测试运行良好。

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

如果我使用sbt it:test 运行,错误是“没有这样的设置/任务”

如果我在 intellij 上运行(即使用“运行”按钮),我会得到

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)

然而,该类显然位于/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"

【问题讨论】:

  • 你能展示你的 build.sbt 吗?
  • 已更新 :) 感谢您的关注

标签: scala integration-testing scalatest


【解决方案1】:

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

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

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

对于所有集成,设置refer

希望对你有帮助。

【讨论】:

    猜你喜欢
    • 2018-03-16
    • 2017-08-17
    • 2014-03-29
    • 1970-01-01
    • 1970-01-01
    • 2020-07-22
    • 1970-01-01
    • 2023-03-12
    • 1970-01-01
    相关资源
    最近更新 更多