You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Quarkus@QuarkusTest测试报错:无法读取配置(Eclipse环境)

解决Eclipse中首次运行@QuarkusTest时的配置读取错误

问题场景

在Eclipse中通过JUnit运行配置执行带有@QuarkusTest注解的测试类(首次运行),出现以下错误:

2025-06-04 16:51:14,318 ERROR [io.qua.tes.jun.AbstractJvmQuarkusTestExtension] 
(main) Could not read configuration while evaluating whether to run class 
foo.bar.Test. This usually happens when re-running a test that has already 
failed, for example if surefire.rerunFailingTestsCount is set. To work around 
this limitation, either adjust the test so that it passes, or isolate the test 
into a project whose tests all use the same combination of @TestProfile and 
resources.

使用Quarkus版本为3.23.0,期望正常执行@QuarkusTest测试。

解决方案

  • 检查JUnit运行配置
    确保运行配置针对整个测试类而非单个测试方法,删除配置中所有自定义的Surefire相关参数(如surefire.rerunFailingTestsCount),必要时删除旧配置,右键测试类重新创建JUnit Test运行配置。

  • 清理项目缓存与编译文件

    1. 删除项目根目录下的target文件夹,包括其中的quarkus-test-cache、test-classes等子目录;
    2. 在Eclipse中执行Project > Clean,选择当前项目完成清理后重新编译。
  • 验证测试配置与资源文件

    1. 若测试类使用了@TestProfile,确认项目内所有测试的Profile配置一致,无冲突;
    2. 检查application-test.properties等测试资源文件,确保无语法错误(如键值对格式错误、缺失必要配置项)。
  • 更新Quarkus Eclipse插件
    打开Help > Eclipse Marketplace,搜索Quarkus Tools插件并更新至最新版本,确保与Quarkus 3.23.0版本兼容。

  • 通过Maven命令行验证
    在项目根目录执行命令:

    mvn test -Dtest=foo.bar.Test
    

    若命令行可正常运行测试,说明问题出在Eclipse运行配置,需重新创建干净的JUnit运行配置。

内容的提问来源于stack exchange,提问作者holz name

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.12 23:38:14