[英]test Grails 3.3.8 app with junit 4 or 5 in eclipse 2018-12, is it possible?
im working on a grails project and i want to add tests to it.我正在处理一个 grails 项目,我想向它添加测试。 I used spock and Geb but i prefer JUnit but it doesnt work.我使用了 spock 和 Geb,但我更喜欢 JUnit,但它不起作用。
im creating a new Groovy Test with the eclipse wizard, i select either junit4 or junit 5 then it creates a new test class我使用 eclipse 向导创建一个新的 Groovy 测试,我 select junit4 或 junit 5 然后它创建一个新测试 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我右键单击并 select 运行为 > Junit 测试它应该显示 junit 视图,但测试失败但没有我得到很多“默认导入 java.util.net/io 的无效 package 绑定”和“无法检索超类”, “AbortCompilation ...无法解决 AssertionError。它是从 org.eclispe.jdt.core 的 required.class 文件间接引用的”
and i get an invocationTargetException caused by a NPE from org.eclispe.jdt.junit我从 org.eclispe.jdt.junit 得到一个由 NPE 引起的 invocationTargetException
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问候
test Grails 3.3.8 app with junit 4 or 5 in eclipse 2018-12, is it possible?在 eclipse 2018-12 中用 junit 4 或 5 测试 Grails 3.3.8 应用程序,这可能吗?
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
or integrationTest
Gradle task with the appropriate parameters.一种常见的方法是在 Eclipse 中创建一个启动配置,它将使用适当的参数执行test
或integrationTest
测试 Gradle 任务。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.