JUnit5 是否向后兼容 JUnit4?

Is JUnit5 backward compatible to JUnit4?

我做了 google 很多;但我既找不到消息来源说 "of course it is" 也找不到消息来源 "no, it isn't; and here it breaks"。

我们使用 EasyMock、PowerMock、Mockito 进行了大约 2000 个质量参差不齐的单元测试;我只是想知道:当切换到 JUnit5 时,这 2000 个测试用例是否有合理的机会正常工作?还是这不太可能,我最好不要花一秒钟的时间去尝试?

换句话说:我正在寻找可以确认的答案"yes, it worked for our large code base";或 "no, it is not at all that easy".

http://junit.org/junit5/docs/current/user-guide/

junit-vintage-engine 用于 运行 junit4 或 3 所以它看起来像 'JUnit Vintage test engine implementation that allows to run vintage JUnit tests, i.e. tests written in the JUnit 3 or JUnit 4 style, on the new JUnit Platform.'

JUnit 5 User Guide所述:

Just make sure that the junit-vintage-engine artifact is in your test runtime path. In that case JUnit 3 and JUnit 4 tests will automatically be picked up by the JUnit Platform launcher.

See the example projects in the junit5-samples repository to find out how this is done with Gradle and Maven.

我目前对我们项目的评估是暂时使用 JUnit 4.12。

截至目前,我们的构建设置是 "different" for eclipse 和我们的 "backend build";意思是:我们不能使用 maven/gradle 在 eclipse 中构建。而且我只是未能 identify/download 我需要替换 junit-4 的 JAR。12.jar 在我们的 eclipse 设置中;甚至不考虑还提供一些(但哪些)其他 JAR 以使 JUnit 5 可用。