使用Gradle,测试在“Instantiating tests...”处挂起20秒

q8l4jmvw  于 2023-08-06  发布在  其他
关注(0)|答案(1)|浏览(457)

我正在使用Gradle运行一个测试,在实际运行测试之前,它显示“示例化测试...”大约20秒钟。我该如何避免这种情况?
x1c 0d1x的数据
我使用Quarkus 2.2.3.Finalgradle-7.2
我的测试类:

class OrganizationServiceImplTest {
    @Test
    void getAllOrganizations() {
        assertTrue(true);
    }
}

字符串
运行配置显示以下运行命令:

:test --tests "com.doortodoor.services.impl.OrganizationServiceImplTest.getAllOrganizations"


建议日志文件显示如下:

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


我尝试过的不起作用的解决方案包括:

方案一:使用Eclipse编译器

Why does IntelliJ take 20+ seconds to launch a unit test?编译器-> Java编译器

  • 使用编译器:月 eclipse
  • 不生成警告

问题:它没有改善时间。

方案二:使用共享Spring上下文

Gradle is executing tests terribly slow because it is adding to much tests to the suite
问题:我没有使用@SpringBootTest注解我的测试(或者使用Spring)。

方案三:启用Eclipse特性,如增量编译

Intellij idea tests compilation takes too long (compared with Eclipse)

ttygqcqt

ttygqcqt1#

对于任何想知道的人,我能够通过将测试运行器更改为File | Settings | Build, Execution, Deployment | Build Tools | Gradle中的IntelliJ Idea来解决长挂起时间。


的数据

相关问题