我正在开发 Eclipse 插件,我需要能够为每个插件自动构建和执行测试套件。(使用 Junit)
测试在 Eclipse 中工作,我可以将插件分解为实际插件和用于单元测试的片段插件,如此处、此处和此处的几个地方所述。
但是,上述每种方法都会导致相同的问题:发出构建或应该触发测试的 java ant 任务/命令行命令不会产生可观察到的副作用,并返回值“13”。我已经尝试了所有我能找到的东西,并且我对 Eclipse 的启动方式有了一些了解(例如:从 v3.3 开始,您不能再使用 startup.jar - 它不存在 - 但您应该使用org.eclipse.equinox.launcher)。不幸的是,虽然这显然是必要的信息,但还远远不够。
我正在使用 Eclipse 3.4、Junit 4.3.1(org.junit4 捆绑包,但我更愿意使用 JUnit 4.4。请参见此处。)
所以,我的问题是:您究竟如何自动化 Eclipse 插件的构建和测试?
编辑:澄清一下,我想使用类似 ant + 巡航控制的东西,但我什至无法让单元测试在Eclipse 之外运行。我说“类似”是因为有其他技术可以完成同样的事情,而且我不会因为使用 Maven 或 Buckminster 等技术而放弃一个可行的解决方案,如果这些技术使这变得更容易的话。
Edit2:上面提到的'Java Result 13'似乎是由于找不到coretestrunner造成的。从日志:
java.lang.RuntimeException: Application "org.eclipse.test.coretestapplication" could not be found in the registry. The applications available are: org.eclipse.equinox.app.error, com.rcpquickstart.helloworld.application.
at org.eclipse.equinox.internal.app.EclipseAppContainer.startDefaultApp(EclipseAppContainer.java:242)
at org.eclipse.equinox.internal.app.MainApplicationLauncher.run(MainApplicationLauncher.java:29)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:382)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
at org.eclipse.equinox.launcher.Main.main(Main.java:1212)
at org.eclipse.core.launcher.Main.main(Main.java:30)
!ENTRY org.eclipse.osgi 2 0 2008-11-04 21:02:10.514
!MESSAGE The following is a complete list of bundles which are not resolved, see the prior log entry for the root cause if it exists:
!SUBENTRY 1 org.eclipse.osgi 2 0 2008-11-04 21:02:10.515
!MESSAGE Bundle update@plugins/org.eclipse.test_3.2.0/ [34] was not resolved.
!SUBENTRY 2 org.eclipse.test 2 0 2008-11-04 21:02:10.516
!MESSAGE Missing required bundle org.apache.ant_0.0.0.
!SUBENTRY 2 org.eclipse.test 2 0 2008-11-04 21:02:10.516
!MESSAGE Missing required bundle org.eclipse.ui.ide.application_0.0.0.
!SUBENTRY 1 org.eclipse.osgi 2 0 2008-11-04 21:02:10.518
!MESSAGE Bundle update@plugins/org.eclipse.ant.optional.junit_3.2.100.jar [60] was not resolved.
!SUBENTRY 2 org.eclipse.ant.optional.junit 2 0 2008-11-04 21:02:10.519
!MESSAGE Missing host org.apache.ant_[1.6.5,2.0.0).
!SUBENTRY 2 org.eclipse.ant.optional.junit 2 0 2008-11-04 21:02:10.519
!MESSAGE Missing required bundle org.eclipse.core.runtime.compatibility_0.0.0.