如何使用SBT运行JUnit 4.11测试用例? [英] How do I run JUnit 4.11 test cases with SBT?
本文介绍了如何使用SBT运行JUnit 4.11测试用例?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在 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屋!
查看全文