重新运行失败的测试junit5黄瓜 [英] rerun failed tests junit5 cucumber

查看:135
本文介绍了重新运行失败的测试junit5黄瓜的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用它来实现junit5黄瓜测试的重运行机制

I am trying to use this to implement a rerun mechanism for junit5 cucumber tests

<dependency>
    <groupId>io.github.artsok</groupId>
    <artifactId>rerunner-jupiter</artifactId>
    <version>2.1.6</version>
    <scope>test</scope>
</dependency>

这是我正在使用的junit和黄瓜的版本

Here are versions of junit and cucumber that I am using

junit-jupiter-api 版本为 5.7.0 cucumber-java 的版本为 6.9.1 ,并且 cucumber-junit-platform-engine 的版本为 6.9.1

junit-jupiter-api version is 5.7.0 cucumber-java version is 6.9.1 and cucumber-junit-platform-engine version is 6.9.1

但是我在编译时会收到此错误

But I am receiving this error when I compile

java.lang.NoClassDefFoundError: org/junit/jupiter/api/extension/ScriptEvaluationException
Caused by: java.lang.ClassNotFoundException: org.junit.jupiter.api.extension.ScriptEvaluationException

当我将 junit-jupiter-api 版本降级为 5.4.2 时,因为 5.7.0 rerunner-jupiter冲突在maven依赖树中,我开始收到此错误

When I downgraded junit-jupiter-api version to 5.4.2 as 5.7.0 was conflicting with rerunner-jupiter in maven dependency tree , I started to get this error

org.apache.maven.surefire.booter.SurefireBooterForkException: There was an error in the forked process
org/junit/platform/commons/PreconditionViolationException

如果还有其他方法可以在junit5黄瓜测试中实现重运行,我也可以利用它

If there's any other way I can achieve rerun in junit5 cucumber tests , I am open to utilize that too

感谢您的帮助

推荐答案

除了依赖关系冲突.

不幸的是,您尝试做的事情基本上是不可能的.JUnit 5由三个部分组成,即JUnit平台,JUnit Jupiter和JUnit Vintage.后两个是JUnit平台上的测试引擎实现.黄瓜JUnit平台引擎也是如此.

Unfortunately what you are trying to do is fundamentally not possible. JUnit 5 consists of three parts, the JUnit Platform, JUnit Jupiter and JUnit Vintage. The latter two are test engine implementations on the JUnit Platform. And so is the Cucumber JUnit Platform Engine.

rerunner-jupiter 扩展了JUnit Jupiter.扩展不是JUnit平台的一部分,因此您不能将它们与Cucumber一起使用.

The rerunner-jupiter extends JUnit Jupiter. Extensions are not part of the JUnit Platform and so you can't use them with Cucumber.

这篇关于重新运行失败的测试junit5黄瓜的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆