Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/309.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java @RunWith(cucumberWithSerentity.class)抛出noClassDefFind cucumber/runtime/junit/Assertions_Java_Junit_Cucumber_Serenity Bdd_Cucumber Serenity - Fatal编程技术网

Java @RunWith(cucumberWithSerentity.class)抛出noClassDefFind cucumber/runtime/junit/Assertions

Java @RunWith(cucumberWithSerentity.class)抛出noClassDefFind cucumber/runtime/junit/Assertions,java,junit,cucumber,serenity-bdd,cucumber-serenity,Java,Junit,Cucumber,Serenity Bdd,Cucumber Serenity,尝试使用JUnit 5以宁静的方式运行Cucumber 当测试运行程序具有@RunWith(Cucumber.class)注释时,测试将运行,尽管Serenity不会记录结果 当测试运行程序具有@RunWith(cucumberWithSerentity.class)时,将抛出“NoClassDefFound cucucumber/runtime/junit/Assertions” 我想可能是JUnit5,所以我切换到JUnit4,同样的结果也发生了 我将示例项目加载到GitHub中: 目标是构

尝试使用JUnit 5以宁静的方式运行Cucumber

当测试运行程序具有
@RunWith(Cucumber.class)
注释时,测试将运行,尽管Serenity不会记录结果

当测试运行程序具有
@RunWith(cucumberWithSerentity.class)
时,将抛出“NoClassDefFound cucucumber/runtime/junit/Assertions”

我想可能是JUnit5,所以我切换到JUnit4,同样的结果也发生了

我将示例项目加载到GitHub中:

目标是构建项目,然后能够在Serenity html输出中看到Cucumber结果


有人知道我哪里出了问题吗?

有两个不同的问题:

依赖关系| java->v4.2.0 我使用的是v4.7.1。当我从4.7.1回滚到4.2.0时,NoClassDefFound错误消失了。 当我升级到4.2.1时,我得到了一个新的NoClassDefFound错误。我尝试了从4.2.1到4.7.1的所有版本,得到了不同的NoClassDefFound错误

依赖性|宁静-黄瓜4-v1.0.17 当我使用v1.0.17时,会出现一个关于缺少依赖项的警告。 当我使用v1.0.15时,这个缺少依赖项的警告消失了

对于serenity-cucumber4使用的serenity剧本和serenity剧本webdriver的v2.0.59版本,似乎有一些不好的引用,但在maven repo中并不存在

这是我遇到的另一个主要问题中没有讨论的障碍

解决
  • 我将cucumber java保持在v4.2.0
  • 我将serenity-cucumber4保持在v1.0.15
一切都好了

有关我如何解决问题的更多信息,请访问:

您还可以在此处看到回购协议:

我升级到Java12,中途实现了JUnit5。TestRunner没有使用替换了@RunWith的@ExtendWith()属性,它仍然使用jupiter vintage软件包中的@RunWith()属性。

请参阅。我希望Serenity只能在复古模式下与JUnit5配合使用