为了账号安全,请及时绑定邮箱和手机立即绑定

Gradle 不执行测试

Gradle 不执行测试

缥缈止盈 2023-03-17 13:54:29
当我运行我的 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.binAll 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-DATETask ':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-DATESkipping 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-SOURCESkipping 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-DATESkipping 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-DATESkipping 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 文件也没有显示任何已执行的测试。
查看完整描述

1 回答

?
浮云间

TA贡献1829条经验 获得超4个赞

您必须在测试配置中启用 JUnit 支持。对于 JUnit 5,将以下内容添加到您的 gradle 构建文件中:

test {
    useJUnitPlatform()
}


查看完整回答
反对 回复 2023-03-17
  • 1 回答
  • 0 关注
  • 268 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信