Migrate 6.3.2 to 6.3.7, junit issue

312 views
Skip to first unread message

Pablo Vidaurri

unread,
Oct 27, 2021, 4:22:19 PM10/27/21
to CAS Community
Upgrading from 6.3.2 to 6.3.7 ... seems like a minor change but I am surprised to see so many files changing. Everything from docker, gradle, and property files. My junit test are no longer executing. Getting the following error during init:

org.junit.platform.commons.JUnitException: TestEngine with ID 'junit-jupiter' failed to execute tests at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:114) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:88) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:54) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:67) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:52) at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:96) at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:75) at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.processAllTestClasses(JUnitPlatformTestClassProcessor.java:99) at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.access$000(JUnitPlatformTestClassProcessor.java:79) at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor.stop(JUnitPlatformTestClassProcessor.java:75) at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.stop(SuiteTestClassProcessor.java:61) at java...@11.0.2/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java...@11.0.2/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java...@11.0.2/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java...@11.0.2/java.lang.reflect.Method.invoke(Method.java:566) at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36) at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24) at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:33) at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94) at com.sun.proxy.$Proxy6.stop(Unknown Source) at org.gradle.api.internal.tasks.testing.worker.TestWorker$3.run(TestWorker.java:193) at org.gradle.api.internal.tasks.testing.worker.TestWorker.executeAndMaintainThreadName(TestWorker.java:129) at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:100) at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:60) at org.gradle.process.internal.worker.child.ActionExecutionWorker.execute(ActionExecutionWorker.java:56) at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:133) at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:71) at app//worker.org.gradle.process.internal.worker.GradleWorkerMain.run(GradleWorkerMain.java:69) at app//worker.org.gradle.process.internal.worker.GradleWorkerMain.main(GradleWorkerMain.java:74) Caused by: java.lang.NoClassDefFoundError: org/junit/platform/commons/util/UnrecoverableExceptions at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:76) at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126) at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84) at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32) at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57) at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:108) ... 28 more

I am using this in my build.gradle file:

testImplementation "org.springframework.boot:spring-boot-starter-test:${project.springBootVersion}"

apply plugin: "jacoco"

test {
    useJUnitPlatform {}
    finalizedBy jacocoTestReport // report is always generated after tests run
    jacoco {
        destinationFile = layout.buildDirectory.file('jacoco/jacocoTest.exec').get().asFile
        classDumpDir = layout.buildDirectory.dir('jacoco/classpathdumps').get().asFile
    }
}

jacocoTestReport {
    dependsOn test
     reports {
        xml.required = true
        csv.required = false
        html.outputLocation = layout.buildDirectory.dir('jacocoHtml')
    }
}
jacoco {
    toolVersion = "0.8.7"
}





Ray Bon

unread,
Oct 27, 2021, 5:03:12 PM10/27/21
to cas-...@apereo.org
Pablo,

Make sure the libraries you import have the same version as the main cas project. This could be library version issues.

Ray

On Wed, 2021-10-27 at 13:22 -0700, Pablo Vidaurri wrote:
Notice: This message was sent from outside the University of Victoria email system. Please be cautious with links and sensitive information.
-- 
Ray Bon
Programmer Analyst
Development Services, University Systems

I acknowledge and respect the lək̓ʷəŋən peoples on whose traditional territory the university stands, and the Songhees, Esquimalt and WSÁNEĆ peoples whose historical relationships with the land continue to this day.

Pablo Vidaurri

unread,
Oct 27, 2021, 5:46:07 PM10/27/21
to CAS Community, Ray Bon
Thanks for the tip. I've in fact removed the version completely as suggested by comments in the new build.gradle file:

dependencies {
    /**
     * CAS dependencies and modules may be listed here.
     *
     * There is no need to specify the version number for each dependency
     * since versions are all resolved and controlled by the dependency management
     * plugin via the CAS bom.
     **/
.
.
.

Pablo Vidaurri

unread,
Nov 9, 2021, 2:05:21 PM11/9/21
to CAS Community
There has to be something wrong with the gradle file for 6.3.7. Checking out the latest 6.3.7, adding an empty Junit test, adding: testImplementation 'org.springframework.boot:spring-boot-starter-test:2.3.7.RELEASE' to gradle file and getting the exact same exception:

> Task :test

UnknownClass.JUnit Jupiter > UnknownClass.initializationError FAILED
    org.junit.platform.commons.JUnitException at EngineExecutionOrchestrator.java:114
        Caused by: java.lang.NoClassDefFoundError at OpenTest4JAndJUnit4AwareThrowableCollector.java:58
            Caused by: java.lang.ClassNotFoundException at BuiltinClassLoader.java:583

UnknownClass.JUnit Jupiter FAILED

2 tests completed, 2 failed

> Task :test FAILED

FAILURE: Build failed with an exception.

Pablo Vidaurri

unread,
Nov 10, 2021, 4:55:24 PM11/10/21
to CAS Community, Pablo Vidaurri
Okay, I'm not a gradle expert yet but I came across this post and it helped solve my problem. Doing a scan as suggested, i was able to see that the junit platform was being downgraded by a plugin.

So after including in my dependencies:
testImplementation 'org.springframework.boot:spring-boot-starter-test'

and including a test block
test {
 useJUnitPlatform {}
}

I also added this to my build.gradle which resolved my issue:
ext['junit-jupiter.version'] = '5.7.2'
Reply all
Reply to author
Forward
0 new messages