JUnit插件测试忽略Eclipse Neon中的目标平台 [英] JUnit Plug-in Test Ignores Target Platform in Eclipse Neon

查看:197
本文介绍了JUnit插件测试忽略Eclipse Neon中的目标平台的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些问题让JUnit插件测试工作使用Eclipse Neon M7,我真的很喜欢任何人使用测试的输入(必须有某人,对吧?)



每当我开始在Eclipse Luna中工作的测试(但是没有在火星,我认为是一个错误),并继续使用Tycho我得到以下异常:

 !SESSIONIBUS-11 10:25:41.456 ------------------------- ---------------------- 
eclipse.buildId = unknown
java.version = 1.8.0_73
java.vendor = Oracle Corporation
BootLoader常量:OS = win32,ARCH = x86,WS = win32,NL = en_US
框架参数:-version 3 -port 60297 -testLoaderClass org.eclipse.jdt.internal.junit4.runner .JUnit4TestLoader -loaderpluginname org.eclipse.jdt.junit4.runtime -classNames org.acme.test.test.core.ActivatorTest -application org.eclipse.pde.ju nit.runtime.uitestapplication -testApplication org.eclipse.ui.ide.workbench -testpluginname test.core
命令行参数:-os win32 -ws win32 -arch x86 -consoleLog -version 3 -port 60297 -testLoaderClass org .eclipse.jdt.internal.junit4.runner.JUnit4TestLoader -loaderpluginname org.eclipse.jdt.junit4.runtime -classNames org.acme.test.test.core.ActivatorTest -application org.eclipse.pde.junit.runtime.uitestapplication - testApplication org.eclipse.ui.ide.workbench -data C:\workspaces\MyWorkspace /../ junit-workspace -dev file:C:/workspaces/MyWorkspace/.metadata/.plugins/org.eclipse.pde。 core / pde-junit / dev.properties -os win32 -ws win32 -arch x86 -consoleLog -testpluginname test.core

!ENTRY org.eclipse.pde.junit.runtime 4 0 though- 11 10:25:42.373
!MESSAGE FrameworkEvent ERROR
!STACK 0
org.osgi.framework.BundleException:无法解析模块:org.eclipse.pde.junit.runtime [81]
未解决的要求:Require-Bundle:org.eclipse.core.run时间; bundle-version =[3.11.0,4.0.0]

在org.eclipse.osgi.container.Module.start(Module.java:434)
在org.eclipse 。org.eclipse.osgi.container.ModuleContainer $ ContainerStartLevel.incStartLevel 。org.eclipse.osgi.container.ModuleContainer $ ContainerStartLevel.dispatchEvent 。org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent .osgi.framework.eventmgr.EventManager $ EventThread.run(EventManager.java:340)

!ENTRY org.eclipse.pde.junit.runtime 2 0/--11 10:25:42.719
!MESSAGE无法解决mo dule:org.eclipse.pde.junit.runtime [81]
未解决的要求:Require-Bundle:org.eclipse.core.runtime; bundle-version =[3.11.0,4.0.0]


!ENTRY org.eclipse.osgi 4 0/--11 10:25:42.720
!MESSAGE应用程序错误
!STACK 1
java.lang.RuntimeException:在注册表中找不到应用程序org.eclipse.pde.junit.runtime.uitestapplication。可用的应用程序有:org.eclipse.ant.core.antRunner,org.eclipse.ui.ide.workbench,org.eclipse.help.base.infocenterApplication,org.eclipse.help.base.helpApplication,org.eclipse.help .base.indexTool,org.acme.test.rxp.rxpdemo,org.eclipse.equinox.app.error。
在org.eclipse.equinox.internal.app.EclipseAppContainer.startDefaultApp(EclipseAppContainer.java:248)
在org.eclipse.equinox.internal.app.MainApplicationLauncher.run(MainApplicationLauncher.java:29)
在org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
在org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher。 java:104)
在org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:382)
在org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter。 java:236)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown来源)
在java.lang.reflect.Method.invoke(未知源)
在org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
在org。蚀.equinox.launcher.Main.basicRun(Main.java:577)
在org.eclipse.equinox.launcher.Main.run(Main.java:1410)
在org.eclipse.equinox.launcher .Main.main(Main.java:1386)

显然,这不是Eclipse的bug,但我做错了事情。在测试中没有指示什么样的插件启动,但从版本范围来看,我认为它是错误的 - 运行的Eclipse实例的插件,而不是在工作区的目标中定义的插件平台。



仍然是发布配置声称使用的是以后的目标平台。



如何配置插件单元测试,以便它将占用当前活动的目标平台?

解决方案

这里的问题是Eclipse 4.4(Luna,2014)及以下版本具有兼容主机Eclipse的 org.eclipse.core.runtime org.eclipse.pde.junit.runtime 的版本。当依赖关系增加时,该值随4.5变化。



正如您正确地得出结论,配置指向错误的 org.eclipse.pde.junit.runtime 的。这可能是由于未清除配置状态。确保配置正在被清除,因此您不会以陈旧的版本运行。这确保在启动配置的配置选项卡中选中清除配置区域



您通过查看 $ {workspace_loc} /。metadata / .plugins / org.eclipse.pde.core / pde-junit / org.eclipse.equinox.simpleconfigurator / bundles,可以准确了解PDE解析为配置的捆绑包。信息(在启动配置的配置选项卡中指定的位置)


I have some problems getting JUnit plug-in tests to work using Eclipse Neon M7 and I'd really like input from anybody out there who uses tests (there has to be somebody, right?).

Whenever I start a test that works in Eclipse Luna (but didn't in Mars, which I assumed was a bug) and continues to work using Tycho I get the following exception:

!SESSION 2016-05-11 10:25:41.456 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.8.0_73
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
Framework arguments:  -version 3 -port 60297 -testLoaderClass org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader -loaderpluginname org.eclipse.jdt.junit4.runtime -classNames org.acme.test.test.core.ActivatorTest -application org.eclipse.pde.junit.runtime.uitestapplication -testApplication org.eclipse.ui.ide.workbench -testpluginname test.core
Command-line arguments:  -os win32 -ws win32 -arch x86 -consoleLog -version 3 -port 60297 -testLoaderClass org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader -loaderpluginname org.eclipse.jdt.junit4.runtime -classNames org.acme.test.test.core.ActivatorTest -application org.eclipse.pde.junit.runtime.uitestapplication -testApplication org.eclipse.ui.ide.workbench -data C:\workspaces\MyWorkspace/../junit-workspace -dev file:C:/workspaces/MyWorkspace/.metadata/.plugins/org.eclipse.pde.core/pde-junit/dev.properties -os win32 -ws win32 -arch x86 -consoleLog -testpluginname test.core

!ENTRY org.eclipse.pde.junit.runtime 4 0 2016-05-11 10:25:42.373
!MESSAGE FrameworkEvent ERROR
!STACK 0
org.osgi.framework.BundleException: Could not resolve module: org.eclipse.pde.junit.runtime [81]
  Unresolved requirement: Require-Bundle: org.eclipse.core.runtime; bundle-version="[3.11.0,4.0.0)"

    at org.eclipse.osgi.container.Module.start(Module.java:434)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1582)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1561)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1533)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1476)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)
    at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
    at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)

!ENTRY org.eclipse.pde.junit.runtime 2 0 2016-05-11 10:25:42.719
!MESSAGE Could not resolve module: org.eclipse.pde.junit.runtime [81]
  Unresolved requirement: Require-Bundle: org.eclipse.core.runtime; bundle-version="[3.11.0,4.0.0)"


!ENTRY org.eclipse.osgi 4 0 2016-05-11 10:25:42.720
!MESSAGE Application error
!STACK 1
java.lang.RuntimeException: Application "org.eclipse.pde.junit.runtime.uitestapplication" could not be found in the registry. The applications available are: org.eclipse.ant.core.antRunner, org.eclipse.ui.ide.workbench, org.eclipse.help.base.infocenterApplication, org.eclipse.help.base.helpApplication, org.eclipse.help.base.indexTool, org.acme.test.rxp.rxpdemo, org.eclipse.equinox.app.error.
    at org.eclipse.equinox.internal.app.EclipseAppContainer.startDefaultApp(EclipseAppContainer.java:248)
    at org.eclipse.equinox.internal.app.MainApplicationLauncher.run(MainApplicationLauncher.java:29)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:382)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:236)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1386)

Clearly it's not a Eclipse bug at this point, but I'm doing something wrong. There is no indication what kind of plug-ins are started in the test, but judging from the version ranges I assume it's the wrong ones again - the plug-ins of the running Eclipse instance instead of the plug-ins defined in the workspace's target platform.

Still the launch configuration claims the later target platform is used.

How do I configure a plug-in unit test so that it will take the currently active target platform?

解决方案

The problem here is that Eclipse 4.4 (Luna, 2014) and below had a version of org.eclipse.core.runtime that was compatible with the host Eclipse version of org.eclipse.pde.junit.runtime. That changed with 4.5 when the dependency increased.

As you have correctly concluded that the configuration is pointing at the wrong org.eclipse.pde.junit.runtime. This is probably due to uncleared configuration state. Ensure that the configuration is being cleared, so you don't run with a stale version. That is ensure that Clear the configuration area before launching is checked in the Configuration tab of launch configuration.

You can see exactly what PDE has resolved as the configured bundles by looking at ${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit/org.eclipse.equinox.simpleconfigurator/bundles.info (location specified in Configuration tab of launch configuration)

这篇关于JUnit插件测试忽略Eclipse Neon中的目标平台的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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