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

编程入门 行业动态 更新时间:2024-10-28 16:19:03
本文介绍了如何使用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测试用例?

本文发布于:2023-07-14 22:21:19,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1107345.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何使用   测试   JUnit   SBT

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!