如何使用 SBT 运行 JUnit 4.11 测试用例? [英] How do I run JUnit 4.11 test cases with SBT?

查看:37
本文介绍了如何使用 SBT 运行 JUnit 4.11 测试用例?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have the following in build.sbt:

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

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

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

I noticed that junit-interface 0.10 depends on junit-dep 4.10. This makes it impossible to compile tests that use assertNotEquals which was introduced in junit 4.11.

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

How do I run JUnit 4.11 test cases with SBT?

推荐答案

使用junit-interface 0.11避免对junit-dep的依赖:

Use junit-interface 0.11 to avoid the dependency on junit-dep:

libraryDependencies += "junit" % "junit" % "4.12" % "test"

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

更新:junit-interface 0.11 通过依赖 junit 而不是 junit-dep 使其可靠.

UPDATE: junit-interface 0.11 makes this reliable by depending on junit rather than junit-dep.

这篇关于如何使用 SBT 运行 JUnit 4.11 测试用例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆