Gradle 不执行测试

当我运行我的 gradle 脚本时,它总是这样做:


> Configure project :

Evaluating root project 'trading-library' using build file 'C:\Users\xxx\Documents\Repositories\Trading_Library\Trading_Library\build.gradle'.

Invalidating in-memory cache of C:\Users\xxx\.gradle\caches\journal-1\file-access.bin

All projects evaluated.

Selected primary task 'cleanTest' from project :

Selected primary task 'test' from project :

Tasks to be executed: [task ':cleanTest', task ':compileJava', task ':processResources', task ':classes', task ':compileTestJava', task ':processTestResources', task ':testClasses', task ':test']

:cleanTest (Thread[Execution worker for ':',5,main]) started.


> Task :cleanTest UP-TO-DATE

Task ':cleanTest' is not up-to-date because:

  Task has not declared any outputs despite executing actions.

:cleanTest (Thread[Execution worker for ':',5,main]) completed. Took 0.002 secs.

:compileJava (Thread[Execution worker for ':',5,main]) started.


> Task :compileJava UP-TO-DATE

Skipping task ':compileJava' as it is up-to-date.

:compileJava (Thread[Execution worker for ':',5,main]) completed. Took 0.029 secs.

:processResources (Thread[Execution worker for ':',5,main]) started.


> Task :processResources NO-SOURCE

Skipping task ':processResources' as it has no source files and no previous output files.

:processResources (Thread[Execution worker for ':',5,main]) completed. Took 0.0 secs.

:classes (Thread[Execution worker for ':',5,main]) started.


> Task :classes UP-TO-DATE

Skipping task ':classes' as it has no actions.

:classes (Thread[Execution worker for ':',5,main]) completed. Took 0.0 secs.

:compileTestJava (Thread[Execution worker for ':',5,main]) started.


> Task :compileTestJava UP-TO-DATE

Skipping task ':compileTestJava' as it is up-to-date.

:compileTestJava (Thread[Execution worker for ':',5,main]) completed. Took 0.032 secs.

:processTestResources (Thread[Execution worker for ':',5,main]) started.


这是 gradle clean 构建后的输出。所以看起来 gradle 没有找到源并且 gradle 也没有执行测试。没有生成测试报告,测试结果 html 文件也没有显示任何已执行的测试。


缥缈止盈
浏览 269回答 1
1回答

浮云间

您必须在测试配置中启用 JUnit 支持。对于 JUnit 5,将以下内容添加到您的 gradle 构建文件中:test {     useJUnitPlatform() }
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java