【问题标题】:JUnit Plug-in Tests Ignoring Target Platform忽略目标平台的 JUnit 插件测试
【发布时间】:2016-01-07 13:58:58
【问题描述】:

我使用tycho-eclipse-plugin-archetype 中的原型创建了一个简单的Eclipse 插件,其中包含一个有效的集成测试项目。除了......它没有。

当我以“JUnit Plug-in Test”开始任何测试时,我得到以下异常:

!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)。测试用例的运行配置与该版本一致,并证明“未检测到问题”。

因此,从路径包含 "/org.eclipse.platform_4.5.1" 的事实来看,我假设它采用当前正在运行的 Eclipse 目标平台,即使在工作区和运行配置。

如何更改 JUnit 插件测试以采用当前活动的目标平台?

【问题讨论】:

    标签: java eclipse junit


    【解决方案1】:

    它在 Eclipse 4.4.2 (Luna) 中工作,因此它可能是 Eclipse Mars 的“功能”之一。

    补充: As explained here,当Eclipse 在工作区的目标平台中找不到插件时,它会使用应用程序文件夹中的插件。当工作空间和 Eclipse 目标平台不同时,这会使测试失败。解决方案是 a) 使用相同的 Eclipse 版本进行开发和项目或 b) 使用水晶球找出缺少哪些测试插件并将它们添加到项目的目标平台。

    【讨论】:

    • 为什么是水晶球?正如您在链接的票证中评论的那样,将 Eclipse PDE 功能添加到项目的目标平台应该可以解决问题。它对我有用,所以感谢您指出正确的方向。
    猜你喜欢
    • 2016-09-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-01-26
    • 2021-12-12
    • 2010-12-13
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多