JUnit插件测试忽略目标平台 [英] JUnit Plug-in Tests Ignoring Target Platform
问题描述
我使用了 tycho-eclipse-plugin-archetype 使用工作集成测试项目创建一个简单的Eclipse插件。除了...它没有。
I've used the archetype from the tycho-eclipse-plugin-archetype to create a simple Eclipse plug-in with a working integration test project. Except... it doesn't.
当我开始任何测试JUnit插件测试我得到以下异常:
When I start any test as "JUnit Plug-in Test" I get the following exception:
!ENTRY org.eclipse.osgi 2 0 2016-01-07 14:43:35.734
!MESSAGE One or more bundles are not resolved because the following root constraints are not resolved:
!SUBENTRY 1 org.eclipse.osgi 2 0 2016-01-07 14:43:35.734
!MESSAGE Bundle initial@reference:file:../../../../../../../Users/MyName/.eclipse/org.eclipse.platform_4.5.1_2043537226_win32_win32_x86_64/plugins/org.eclipse.pde.junit.runtime_3.4.500.v20150423-1241.jar/ was not resolved.
!SUBENTRY 2 org.eclipse.pde.junit.runtime 2 0 2016-01-07 14:43:35.734
!MESSAGE Missing required bundle org.eclipse.core.runtime_[3.11.0,4.0.0).
(以及其他插件的一些类似消息。)
这是很奇怪的,因为我的目标平台包含 org.eclipse.pde.junit.runtime
3.4.300,而不是3.4 .500,需要 org.eclipse.core.runtime
版本[3.3.0,4.0.0]。测试用例的运行配置与该版本一致,并证明没有检测到问题。
Which is weird, because my target platform contains org.eclipse.pde.junit.runtime
3.4.300, not 3.4.500, which requires org.eclipse.core.runtime
version [3.3.0,4.0.0). The run configuration for the test case agrees with that version and attests "No problems were detected."
因此,路径包含/ org。 eclipse.platform_4.5.1我假设它需要当前正在运行的Eclipse目标平台,即使在工作区和运行配置中还有另一个集合。
So from the fact that the path contains "/org.eclipse.platform_4.5.1" I assume that it takes the currently running Eclipse target platform, even though there's another set in the workspace and in the run configuration.
如何更改JUnit插件测试以获取当前活动的目标平台?
How do I change JUnit plug-in tests to take the currently active target platform?
推荐答案
它适用于Eclipse 4.4.2 (Luna),所以它可能是Eclipse Mars的功能之一。
It works in Eclipse 4.4.2 (Luna), so it's probably one of the "features" of Eclipse Mars.
Addition: As explained here, Eclipse uses plug-ins from the application folder when it can't find them in the workspace's target platform. This makes the tests fail when the workspace and Eclipse target platform differ. The solution is to a) use the same Eclipse version for development and the project or b) use a cristall ball to figure out which test plug-ins are missing and add them to the project's target platform.
这篇关于JUnit插件测试忽略目标平台的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!