I am running a test using Gradle and it says "Instantiating tests..." for about 20 seconds before actually running the test. How can I avoid this?
I am using Quarkus 2.2.3.Final
, and gradle-7.2
.
My test class:
class OrganizationServiceImplTest {
@Test
void getAllOrganizations() {
assertTrue(true);
}
}
The Run Configuration shows the following run command:
:test --tests "com.doortodoor.services.impl.OrganizationServiceImplTest.getAllOrganizations"
Idea Log File shows as follows:
2022-11-09 21:56:29,387 [117677008] INFO - s.plugins.gradle.GradleManager - Instructing gradle to use java from C:\Program Files\OpenJDK\jdk-17.0.2
2022-11-09 21:56:29,387 [117677008] INFO - s.plugins.gradle.GradleManager - Instructing gradle to use java from C:\Program Files\OpenJDK\jdk-17.0.2
2022-11-09 21:56:29,466 [117677087] INFO - xecution.GradleExecutionHelper - Passing command-line args to Gradle Tooling API: --init-script C:\Users\242924\AppData\Local\Temp\1\ijmapper.gradle --tests com.doortodoor.services.impl.OrganizationServiceImplTest.getAllOrganizations --init-script C:\Users\242924\AppData\Local\Temp\1\ijresolvers.gradle
2022-11-09 21:56:30,284 [117677905] INFO - rationStore.ComponentStoreImpl - Saving appDaemonCodeAnalyzerSettings took 64 ms
2022-11-09 21:56:30,381 [117678002] INFO - rationStore.ComponentStoreImpl - Saving Project(name=quarkus-quickstart-security, containerState=COMPONENT_CREATED, componentStore=C:\source\quarkus-quickstart-security)Encoding took 11 ms, RunManager took 36 ms
Solutions I have tried that didn't work include:
Why does IntelliJ take 20+ seconds to launch a unit test? Compiler -> Java Compiler
Problem: It didn't improve the time.
Gradle is executing tests terribly slow because it is adding to much tests to the suite
Problem: I'm not annotating my tests with @SpringBootTest
(or using Spring for that matter).
Intellij idea tests compilation takes too long (compared with Eclipse)
For anybody wondering, I was able to resolve the long hanging time by changing the test runner to IntelliJ Idea in File | Settings | Build, Execution, Deployment | Build Tools | Gradle
.