在Eclipse Indigo中运行JUnit插件测试的正确目标平台? [英] Right target platform for running JUnit plugin tests in Eclipse Indigo?

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

问题描述

对于我的Eclipse插件项目,我定义了以下目标平台:

For my Eclipse plugin project, I have defined the following target platform:

<location includeAllPlatforms="true" includeMode="slicer" includeSource="true" type="InstallableUnit">
  <unit id="org.eclipse.equinox.executable.feature.group" version="3.5.0.v20110530-7P7NFUFFLWUl76mart"/>
  <unit id="org.eclipse.rcp.sdk.id" version="3.7.1.M20110909-1335"/>
  <unit id="org.eclipse.jdt.feature.group" version="3.7.1.r371_v20110810-0800-7z8gFcoFMLfTabvKsR5Qm9rBGEBK"/>
  <unit id="epp.package.java" version="1.4.1.20110909-1818"/>
...

我的插件具有JUnit插件测试(在同一个插件中)。如果我尝试使用JUnit启动配置( org.eclipse.platform.ide )运行它们,我将收到以下关于 junit 和一个例外:

My plugin has JUnit plugin tests (in the same plugin). If I try to run them with a JUnit launch config (org.eclipse.platform.ide), I get the following console messages about junit, and an exception:

!ENTRY org.eclipse.osgi 2 0 2011-12-16 13:00:35.206
!MESSAGE One or more bundles are not resolved because the following root constraints are not resolved:
!SUBENTRY 1 org.eclipse.osgi 2 0 2011-12-16 13:00:35.206
!MESSAGE Bundle reference:file:/Users/stolz/ws-bucky/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.jdt.junit4.runtime_1.1.200.v20110505-0800.jar was not resolved.
!SUBENTRY 2 org.eclipse.jdt.junit4.runtime 2 0 2011-12-16 13:00:35.206
!MESSAGE Missing required bundle org.junit_4.7.0.
!SUBENTRY 1 org.eclipse.osgi 2 0 2011-12-16 13:00:35.207
!MESSAGE Bundle reference:file:/Users/stolz/ws-bucky/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.junit4_4.8.1.v20100525/ was not resolved.
!SUBENTRY 2 org.junit4 2 0 2011-12-16 13:00:35.207
!MESSAGE Missing required bundle org.junit_4.8.1.

!SUBENTRY 1 org.eclipse.osgi 2 0 2011-12-16 13:00:35.234
!MESSAGE Bundle org.junit4_4.8.1.v20100525 [219] was not resolved.
!SUBENTRY 2 org.junit4 2 0 2011-12-16 13:00:35.235
!MESSAGE Missing required bundle org.junit_4.8.1.

!ENTRY org.eclipse.core.net 1 0 2011-12-16 13:00:39.889
!MESSAGE System property http.nonProxyHosts has been set to local|*.local|169.254/16|*.169.254/16 by an external source. This value will be overwritten using the values from the preferences
Exception in thread "Plug-in Tests Runner" java.lang.IllegalArgumentException: Bundle "org.eclipse.jdt.junit4.runtime" not found. Possible causes include missing dependencies, too restrictive version ranges, or a non-matching required execution environment.
    at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.getClassLoader(RemotePluginTestRunner.java:77)
    at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.readPluginArgs(RemotePluginTestRunner.java:93)
    at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.init(RemotePluginTestRunner.java:83)
    at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:61)
    at org.eclipse.pde.internal.junit.runtime.PlatformUITestHarness$1.run(PlatformUITestHarness.java:47)
    at java.lang.Thread.run(Thread.java:680)

使用默认的JDT安装,单元测试运行正常,只是我想要为Hudson-build定义一个合适的目标平台。不用说,我尝试在各个地方的两个违规平台上添加依赖关系,无济于事。

With the default JDT installation, the unit test runs fine, it's just that I want to define a proper target platform for a Hudson-build. Needless to say, I tried adding dependencies on the two offending platforms in various places, to no avail.

更新
Whoops我混淆了另一套测试;这些不是无头,而是工作台测试。

Update: Whoops, I confused this with another set of tests; these here are not headless but workbench-tests.

另一个奇怪的是,有时我在切换到默认值后首次运行测试时不会看到此错误Eclipse平台回我的。

Another oddity is that sometimes I won't see this error when running the test for the first time after switching to the default Eclipse platform and back to mine. Odd.

推荐答案

我不喜欢在这里吹我自己的角,但现在我可以想到的唯一的解决方法在另外几个小时的实验之后)将launch-config设置为所有工作区和启用的目标插件,而不是使用功能或基于插件的启动。我认为这表明在插件解析过程中,Eclipse默认情况下是正确的,但是当您开始限制可用的功能/插件时,并不是这样。

I don't like to blow my own horn here, but the only workaround I could come up with now (after another few hours of experimentation) is setting the launch-config to "all workspace and enabled target plugins" instead of either using a feature or plugin-based launch. I think this indicates that there is something fishy in the plugin-resolution process which Eclipse gets right by default, but not when you start restricting the available features/plugins.

这种变化似乎可以在Eclipse和Buckminster中可靠地工作(从原始问题的问题设置中离开目标平台(!))。所以我得出结论,目标平台原则上是正确的,它一定是关于发布的一些东西。

With that change, it seems to reliably work both within Eclipse and Buckminster (leaving the target platform unchanged(!) from the problematic setup in the original question). So I conclude that the target platform is in principle correct, it must have been something about the launch.

感谢大家的(@ andrew-eisenberg,@PaulWebster)输入!

Thanks for everyone's (@andrew-eisenberg, @PaulWebster at least) input!

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

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