Maven Surefire + Junit + Powermock

问题描述

我有一个 Maven 项目,我在其中将 PowerMock 与 Junits 一起使用。项目包含各种 Junit 5 测试用例和一些 Junit 4 测试用例。其中一个测试用例有以下注释:

@RunWith(powermockrunner.class)
@powermockrunnerDelegate(JUnitPlatform.class)

解决 JUnitPlatform,我必须在 pom.xml 中添加“junit-platform-runner”依赖项,但是在我添加它的那一刻,Maven 忽略了 JUnit 5 测试用例。

<dependency>
    <groupId>org.junit.platform</groupId>
    <artifactId>junit-platform-runner</artifactId>
    <version>1.7.0</version>
    <scope>test</scope>
</dependency>

如果没有这个依赖,Maven 可以在同一个项目中同时运行 Junit 4 和 5 测试。

如何配置 Maven 以使其可以运行 Junit 5 和 4 测试用例以及具有如上所示注释的测试?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)