如何使用run As运行JUnit 5测试>;Eclipse中的SWTBot测试

如何使用run As运行JUnit 5测试>;Eclipse中的SWTBot测试,junit,eclipse-plugin,eclipse-rcp,junit5,swtbot,Junit,Eclipse Plugin,Eclipse Rcp,Junit5,Swtbot,我有两个使用SWTBot 2.8.0(在撰写本文时,是最新版本)的非常简单的UI测试。它们保存在Eclipse插件片段中,不使用任何JUnit4规范,如@RunWith(SWTBotJunit4ClassRunner.class): 公共类MyTest{ 专用最终SWTBot bot=新SWTBot(); @试验 公开无效测试(){ // … } } 现在,如果我从org.junit.Test切换到junit 5的org.junit.jupiter.api.Test,然后尝试通过run As>

我有两个使用SWTBot 2.8.0(在撰写本文时,是最新版本)的非常简单的UI测试。它们保存在Eclipse插件片段中,不使用任何JUnit4规范,如
@RunWith(SWTBotJunit4ClassRunner.class)

公共类MyTest{
专用最终SWTBot bot=新SWTBot();
@试验
公开无效测试(){
// …
}
}
现在,如果我从
org.junit.Test
切换到junit 5的
org.junit.jupiter.api.Test
,然后尝试通过run As>SWTBot Test运行测试,我会得到以下错误:

Exception in thread "WorkbenchTestable" java.lang.IllegalArgumentException: Error: test loader org.eclipse.jdt.internal.junit5.runner.JUnit5TestLoader not found:
org.junit.platform.commons.util.PreconditionViolationException: Cannot create Launcher without at least one TestEngine; consider adding an engine implementation JAR to the classpath
    at org.junit.platform.commons.util.Preconditions.condition(Preconditions.java:295)
    at org.junit.platform.launcher.core.DefaultLauncher.<init>(DefaultLauncher.java:58)
    at org.junit.platform.launcher.core.LauncherFactory.create(LauncherFactory.java:91)
    at org.junit.platform.launcher.core.LauncherFactory.create(LauncherFactory.java:67)
    at org.eclipse.jdt.internal.junit5.runner.JUnit5TestLoader.<init>(JUnit5TestLoader.java:34)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at java.lang.Class.newInstance(Class.java:442)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.createRawTestLoader(RemoteTestRunner.java:370)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.createLoader(RemoteTestRunner.java:365)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.defaultInit(RemoteTestRunner.java:309)
    at org.eclipse.swtbot.eclipse.core.RemotePluginTestRunner.init(RemotePluginTestRunner.java:85)
    at org.eclipse.swtbot.eclipse.core.RemotePluginTestRunner.main(RemotePluginTestRunner.java:63)
    at org.eclipse.swtbot.eclipse.core.UITestApplication.runTests(UITestApplication.java:120)
    at org.eclipse.e4.ui.internal.workbench.swt.E4Testable.lambda$0(E4Testable.java:76)
    at java.lang.Thread.run(Thread.java:748)
我还需要向
Require Bundle
头添加什么来消除上述异常


注意:相反,RunAs>JUnit插件测试会正确初始化测试运行程序(JUnit视图显示Test
Test.Test
with
runner:JUnit 5
),但随后会冻结,因为在UI threat上运行的测试当然是一个。

SWTBot只支持从SWTBot 3.0开始的JUnit 5,根据.

FWIW,作为Eclipse2020-06的一部分发布,需要包
org.Eclipse.jdt.junit5.runtime
,其中包含
org.Eclipse.jdt.internal.junit5.runner.JUnit5TestLoader
类,也没有帮助。
Require-Bundle: org.eclipse.swtbot.swt.finder;bundle-version="[2.7.0,3.0.0)",
 org.junit;bundle-version="[4.12.0,5.0.0)",
 org.junit.jupiter.api;bundle-version="[5.4.0,6.0.0)",
 org.junit.jupiter.engine;bundle-version="[5.4.0,6.0.0)"