'test Grails 3.3.8 app with junit 4 or 5 in eclipse 2018-12, is it possible?

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



Solution 1:[1]

test Grails 3.3.8 app with junit 4 or 5 in eclipse 2018-12, is it possible?

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.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jeff Scott Brown