Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/redis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java JUnit插件测试忽略Eclipse中的目标平台_Java_Eclipse_Junit_Eclipse Plugin - Fatal编程技术网

Java JUnit插件测试忽略Eclipse中的目标平台

Java JUnit插件测试忽略Eclipse中的目标平台,java,eclipse,junit,eclipse-plugin,Java,Eclipse,Junit,Eclipse Plugin,我在使用EclipseNeon M7进行JUnit插件测试时遇到了一些问题,我非常希望任何使用测试的人(一定有人,对吧?) 每当我启动一个在Eclipse Luna中运行的测试(但是,我认为这是一个bug)并继续使用Tycho时,我都会遇到以下异常: !SESSION 2016-05-11 10:25:41.456 ----------------------------------------------- eclipse.buildId=unknown java.version=1.8.0_

我在使用EclipseNeon M7进行JUnit插件测试时遇到了一些问题,我非常希望任何使用测试的人(一定有人,对吧?)

每当我启动一个在Eclipse Luna中运行的测试(但是,我认为这是一个bug)并继续使用Tycho时,我都会遇到以下异常:

!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)
显然,这不是一个Eclipse错误,但我做错了什么。没有迹象表明在测试中启动了什么样的插件,但从版本范围判断,我认为这又是错误的插件——运行Eclipse实例的插件,而不是工作区目标平台中定义的插件

不过,发射配置声称使用了更晚的目标平台


如何配置插件单元测试,使其能够使用当前活动的目标平台?

这里的问题是Eclipse 4.4(Luna,2014)及以下版本的org.Eclipse.core.runtime与主机Eclipse版本的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.info(在启动配置的配置选项卡中指定的位置),您可以确切地看到PDE解析为配置的捆绑包。

您的目标平台基于eclipse 3.7/8吗?当我的开发版本和目标平台版本不同时,我遇到了类似的问题,我将尝试找出解决问题的方法。@JonahGraham是的,它是Eclipse3.7,明显比EclipseNeon旧。请找出问题的解决办法:)我无法重现问题,因此无法找到解决办法。我提供了我的笔记作为回答,希望它能对您有所帮助。默认情况下,测试会选中“清除工作区数据”和“启动前清除配置区域”,因此我无法更改任何内容。除了工作区目标平台中的版本外,他为什么还要使用其他版本?我们的默认目标平台中没有
simpleconfigurator
,但如果这是问题所在,我会尝试添加它。
simpleconfigurator
帮助我发现我的目标平台缺少“
org.eclipse.pde.junit.runtime
”,因此Eclipse出于某种奇怪的原因使用了插件文件夹中的包。+1指出了
bundles.info
文件,您可以在该文件中看到哪些包是由PDE解决的-它帮助我解决了一个类似的问题,该问题是由从Eclipse安装而不是目标加载
org.Eclipse.jdt.junit4.runtime
引起的平台