No tests found with test runner 'JUnit 5' in Eclipse Photon

3354 views
Skip to first unread message

Ken Kousen

unread,
Aug 1, 2018, 9:32:02 AM8/1/18
to Spock Framework - User
The subject says it all. I normally use IntelliJ, but when I tried to run a Spock test in Eclipse Photon, I got the above message. It won't run, apparently because their internal JUnit runner is using JUnit 5, and of course Spock still uses the @RunWith annotation from JUnit 4.

Thanks for any help you can give,

Ken

Ken Kousen

unread,
Aug 1, 2018, 10:49:50 AM8/1/18
to Spock Framework - User
If I add the JUnit 5 dependencies to my Gradle build:

test {
    useJUnitPlatform()
}

dependencies {
    implementation "org.codehaus.groovy:groovy-all:2.5.1"
    // etc

    testImplementation group: 'org.hamcrest', name: 'hamcrest-library', version: '1.3'
    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.2.0'
    testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.2.0'
    testImplementation 'org.junit.vintage:junit-vintage-engine:5.2.0'
// ...
}

The tests are now found by Eclipse and work. I'm not sure why, given that JUnit 5 is supposed to be built-in, but there you are.
Reply all
Reply to author
Forward
0 new messages