junit - 如何使用 SBT 运行 JUnit 4.11 测试用例?

标签 junit sbt

我在build.sbt中有以下内容:

libraryDependencies += "com.novocode" % "junit-interface" % "0.10" % "test"

libraryDependencies += "junit" % "junit" % "4.11" % "test"

我注意到 junit-interface 0.10 依赖于 junit-dep 4.10。这使得无法编译使用 assertNotEquals 的测试,该测试是在 junit 4.11 中引入的。

如何使用 SBT 运行 JUnit 4.11 测试用例?

最佳答案

我会这样做:

libraryDependencies ++= Seq(
  "junit" % "junit" % "4.11" % Test,
  "com.novocode" % "junit-interface" % "0.11" % Test
        exclude("junit", "junit-dep")
)

通过排除我们不想要的东西,它不会造成干扰。这不依赖于排序。

关于junit - 如何使用 SBT 运行 JUnit 4.11 测试用例?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22200130/

相关文章:

java - Eclipse IDE 中未读取 SystemPropertyVariables

java - Selenium 简单 Chrome WebDriver : java compilation and execution problems

java - JUnit5:指定多个@Nested 类的执行顺序

mysql - 找不到适合 jdbc :mysql when running from single jar 的驱动程序

testing - 在 Play-SBT 中配置 HTMLUNIT 的日志级别

scala - SBT:动态检测建筑平台

java - Spring 4 TestNG +@Autowired

sbt - 在 SBT 构建任务 : reference configuration unexpectedly missing 中运行 akka

scala - 玩! 2.0框架多Module项目

testing - JUnit 使用 Spring MVC 测试 web.xml