JUnit Plug-in Tests Ignoring Target Platform

让人想犯罪 __ 提交于 2019-12-29 08:20:10

问题


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.

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).

(And some similar messages for other plug-ins.)

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."

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.

How do I change JUnit plug-in tests to take the currently active target platform?


回答1:


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.



来源:https://stackoverflow.com/questions/34657010/junit-plug-in-tests-ignoring-target-platform

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!