在 eclipse 2018-12 中使用 junit 4 或 5 测试 Grails 3.3.8 应用程序,可能吗?
我正在开发一个 grails 项目,我想向它添加测试。 我使用了 spock 和 Geb,但我更喜欢 JUnit,但它不起作用。
我使用 eclipse 向导创建一个新的 Groovy 测试,我选择 junit4 或 junit 5 然后它创建一个新的测试类,
我右键单击并选择运行方式>联合测试 它应该显示 junit 视图,测试失败,但没有 我收到很多“默认导入 java.util/net/io 的包绑定无效” 和“无法检索超类”,“AbortCompilation ... AssertionError 无法解析。它是从所需的 .class 文件间接引用的” 来自 org.eclispe.jdt.core
,我从 org.eclispe.jdt.junit 得到一个由 NPE 引起的 invokingTargetException ,
这些是我多次尝试中的最后一个错误,我觉得这是不可能做到的。
如果有人设法让它发挥作用,请告诉你你是如何做到
的
i m working on a grails project and i want to add tests to it.
I used spock and Geb but i prefer JUnit but it doesnt work.
i m creating a new Groovy Test with the eclipse wizard, i select either junit4 or junit 5
then it creates a new test class
i right click and select run as> Junit Test
it should show the junit view with failing test but no
i get a lot of "Invalid package binding for default import java.util/net/io"
and a "could not retrieve superclass","AbortCompilation ... AssertionError cannot be resolved. it is indirectly referenced from required .class file"
from org.eclispe.jdt.core
and i get an invocationTargetException caused by a NPE from org.eclispe.jdt.junit
those are my last errors from my many attempts, i feel like it s just impossible to do it.
if someone managed to make it work, pls tell how you did it
regards
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的。有很多方法可以做到这一点。
一种常见的方法是在 Eclipse 中创建一个启动配置,该配置将使用适当的参数执行
test
或integrationTest
Gradle 任务。Yes, it is. There are numerous ways to do that.
A common way to do that is to create a launch config in Eclipse that will execute the
test
orintegrationTest
Gradle task with the appropriate parameters.