Serenity聚合功能getFailingOrErrorTests()方法报错问题求助
该错误属于NoSuchMethodError类型,根因是Serenity相关依赖版本不匹配:你当前引入的serenity-core包版本中,不存在net.thucydides.core.reports.TestOutcomes.getFailingOrErrorTests()方法,和你使用的聚合报告模块、Cucumber适配模块的版本要求不符。
排查解决步骤
- 统一所有Serenity相关依赖的版本号,禁止不同Serenity模块混用不同版本:
所有serenity-core、serenity-cucumber、serenity-maven-plugin/serenity-gradle-plugin的版本必须完全一致,建议选择官方发布的稳定版本,避免使用快照版。 - 排查冲突的传递依赖:
Maven项目执行mvn dependency:tree,Gradle项目执行./gradlew dependencies,查看是否有低版本的serenity-core被其他依赖间接引入,如果存在则在对应依赖配置中手动排除低版本传递依赖。 - 清理缓存强制刷新依赖:
执行mvn clean install -U(Maven) 或./gradlew clean build --refresh-dependencies(Gradle),清理本地构建缓存并强制拉取匹配版本的依赖包,避免本地旧缓存包干扰。 - 确认版本适配要求:
- Serenity 3.x及以上版本要求JDK版本 ≥ 11,Cucumber版本 ≥7.x
- 如果你仍在使用JDK8,需选择2.x系列的Serenity稳定版本,不要升级到3.x及以上版本
报错信息参考:
"net.thucydides.core.reports.TestOutcomes.getFailingOrErrorTests()Lnet/thucydides/core/reports/TestOutcomes"报错截图:
内容的提问来源于stack exchange,提问作者Nachiyar-09
相关产品推荐
相关产品推荐


