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

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

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

发布评论

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

>www.elefans.com

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