[英]Configuring @RunWith to use CucumberWithSerenity.class instead of Cucumber.class in IntelliJ runners
[英]@RunWith(CucumberWithSerenity.class) throws NoClassDefFound cucumber/runtime/junit/Assertions
尝试使用 JUnit 5 使用 Serenity 运行 Cucumber。
当测试运行器具有@RunWith(Cucumber.class)
注释时,测试会运行,但 Serenity 不会记录结果。
当测试运行器有@RunWith(CucumberWithSerenity.class)
,会抛出“NoClassDefFounducumber/runtime/junit/Assertions”。
我认为它可能是 JUnit 5,所以我切换到 JUnit 4 并且发生了相同的结果。
我将示例项目加载到 GitHub: https : //github.com/WB3Tech/Cucumber-Serenity-JUnit5
目标是构建项目然后能够在 Serenity html 输出中看到 Cucumber 结果。
任何人都知道我可能会出错的地方?
请参阅https://github.com/serenity-bdd/serenity-core/#cucumber-4 。 我希望 Serenity 只能在老式模式下与 JUnit 5 一起使用。
有两个不同的问题:
我使用的是 v4.7.1。 当我从 4.7.1 回滚到 4.2.0 时,NoClassDefFound 错误消失了。 当我升级到 4.2.1 时,出现了一个新的 NoClassDefFound 错误。 我尝试了从 4.2.1 到 4.7.1 的所有版本,但遇到了不同的 NoClassDefFound 错误。
当我使用 v1.0.17 时,出现关于缺少依赖项的警告。 当我使用 v1.0.15 时,这个缺少依赖项的警告消失了。
似乎对 Maven 存储库中不存在的 serenity-cucumber4 使用的 serenity-screenplay 和 serenity-screenplay-webdriver 的 v2.0.59 有不好的引用。
这是我遇到的另一个障碍,在主要问题中没有讨论
现在一切正常
您可以在以下位置阅读有关我如何解决问题的更多信息: https : //github.com/serenity-bdd/serenity-cucumber4/issues/9
您还可以在此处查看存储库: https : //github.com/WB3Tech/Cucumber-Serenity-JUnit5
我升级到 Java 12,中途实现了 JUnit5。 TestRunner 没有使用取代@RunWith 的@ExtendWith() 属性,它仍然使用jupiter-vintage 包中的@RunWith() 属性。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.