UI-Integration Testing

Hi

I tried following the new documentation in here

But got:

org.gradle.api.internal.tasks.testing.TestSuiteExecutionException: Could not start Gradle Test Executor 1.
	at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.startProcessing(SuiteTestClassProcessor.java:45)
	at java.base@21.0.6/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base@21.0.6/java.lang.reflect.Method.invoke(Method.java:580)
	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:92)
	at jdk.proxy1/jdk.proxy1.$Proxy4.startProcessing(Unknown Source)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker$1.run(TestWorker.java:168)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.executeAndMaintainThreadName(TestWorker.java:132)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:103)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:63)
	at org.gradle.process.internal.worker.child.ActionExecutionWorker.execute(ActionExecutionWorker.java:56)
	at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:121)
	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.util.ServiceConfigurationError: org.junit.platform.launcher.LauncherSessionListener: Provider com.intellij.tests.JUnit5TestSessionListener could not be instantiated
	at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:586)
	at java.base/java.util.ServiceLoader$ProviderImpl.newInstance(ServiceLoader.java:813)
	at java.base/java.util.ServiceLoader$ProviderImpl.get(ServiceLoader.java:729)
	at java.base/java.util.ServiceLoader$3.next(ServiceLoader.java:1403)
	at java.base/java.lang.Iterable.forEach(Iterable.java:74)
	at org.junit.platform.launcher.core.LauncherFactory.createLauncherSessionListener(LauncherFactory.java:154)
	at org.junit.platform.launcher.core.LauncherFactory.openSession(LauncherFactory.java:98)
	at org.junit.platform.launcher.core.LauncherFactory.openSession(LauncherFactory.java:82)
	at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$BackwardsCompatibleLauncherSession.open(JUnitPlatformTestClassProcessor.java:323)
	at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor.createTestExecutor(JUnitPlatformTestClassProcessor.java:86)
	at org.gradle.api.internal.tasks.testing.junit.AbstractJUnitTestClassProcessor.startProcessing(AbstractJUnitTestClassProcessor.java:44)
	at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.startProcessing(SuiteTestClassProcessor.java:43)
	... 16 more
Caused by: java.lang.NoClassDefFoundError: com/intellij/rt/execution/junit/FileComparisonData
~

I also tried adding Junit 4 to the integration test runtime configuration, but it didn’t help.

Any other suggestions?

P.S. - there is a missing closing bracket in the docs on this part:

dependencies {
  intellijPlatform {
    //...
    testFramework(TestFrameworkType.Starter)
  }

sourceSets {
  create("integrationTest") {
    compileClasspath += sourceSets.main.get().output
    runtimeClasspath += sourceSets.main.get().output
  }
}...

Also looks like the dependencies from the testFramework are not aligned with the target version:

After some cleanup and invalidation of the cache, and rerun task, now only the

com.jetbrains.intellij.tools:ide-starter-squashed

It is with 109 and not with the latest EAP 200 - not sure it is related

I think that the root issue is some dependencies that are missing in the integration test configuration but those are present in the test configuration.

Hi

Still can’t make this documentation work.

This is the exception I am getting:
aused by: java.lang.NoClassDefFoundError: com/intellij/rt/execution/junit/FileComparisonData
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1027)
at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150)

Can anyone share their configuration with a dedicated source set?

Thanks

I had tons of issues with NoClassDefFoundErrors at first as well. What I did was to make sure I always had a good place to start.

So, I cloned the intellij-ide-starter, and ran the example tests there. If you can’t get those to work, then it’s unlikely you’ll get your test project to work either!

I’m behind a corporate firewall using ZScaler, so I had tons of issues just installing the ZScaler certificates into my jvm so that gradle could download the artifacts. After about a week of going through all that, I tried ignoring certs, importing them, etc. it turned out I needed to also download and install the intermediary certs… Then it worked. But you didn’t need to know that.

Then I was able to get the example to work.

Then I compared nearly every tiny thing from the example, and my project that I had started using the template repo that intellij has setup. It turns out the template is out of date and using new approaches that aren’t entirely supported anymore, so I abandoned the changes from the template project, mostly, and used the format of the example project from the starter.

That worked for me.

Can you tell me if you’re able to just clone the starter repo and run the example project?

Same problem, fixed by adding this:

integrationTestImplementation("com.jetbrains.intellij.java:java-rt:243.26053.27")