尝试使用JUnit 5以Serenity运行Cucumber。
当测试运行程序具有@RunWith(Cucumber.class)
批注时,尽管Serenity不会记录结果,但运行测试。
当测试运行程序具有@RunWith(CucumberWithSerenity.class)
时,将引发“ NoClassDefFound黄瓜/运行时/ junit / Assertions”。
我以为可能是JUnit 5,所以我切换到JUnit 4,结果还是一样。
我将示例项目加载到GitHub:https://github.com/WB3Tech/Cucumber-Serenity-JUnit5
目标是构建项目,然后能够在Serenity html输出中查看Cucumber结果。
有人知道我可能要去哪里了吗?
答案 0 :(得分:1)
请参见https://github.com/serenity-bdd/serenity-core/#cucumber-4。我希望Serenity仅能在老式模式下使用JUnit 5。
答案 1 :(得分:0)
有两个独立的问题:
我正在使用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时,此丢失的依赖项警告消失了。
似乎对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()属性。