title: Automating unit tests (junit) for Eclipse Plugin development
body: <p>I am developing Eclipse plugins, and I need to be able to automate the building and execution of the test suite for each plugin.  (Using Junit)</p>
  
  <p>Test are working within Eclipse, and I can break the plugins into the actual plugin and a fragment plugin for unit testing as described <a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.test/testframework.html?view=co" rel="nofollow noreferrer">here</a>, <a href="http://rcpquickstart.com/2007/08/06/running-automated-tests-with-pde-build/" rel="nofollow noreferrer">here</a> and in a couple places <a href="http://eclipsenuggets.blogspot.com/2007/09/6-great-links-for-eclipse-build.html" rel="nofollow noreferrer">here</a>.</p>
  
  <p>However, each of the approaches above results in the same issue:  The java ant task/commandline command that issues the build or should trigger the test, generates no observable side effects, and returns the value "13".  I've tried everything I can find, and I've learned a fair bit about how Eclipse starts up (eg: since v3.3 you can no longer use startup.jar -- it doesn't exist -- but you should use <a href="http://blog.ciscavate.org/2008/11/treat-your-mailing-lists-like-reference-documents-please.html" rel="nofollow noreferrer">org.eclipse.equinox.launcher</a>).  Unfortunately, while that is apparently necessary information, it is far from sufficient.</p>
  
  <p>I am working with Eclipse 3.4, Junit 4.3.1 (the org.junit4 bundle, but I would much rather use JUnit 4.4.  See <a href="https://stackoverflow.com/questions/251791">here</a>.)</p>
  
  <p>So, my question is: How exactly do you automate the build and testing of Eclipse plugins? </p>
  
  <p><em>Edit:</em> To clarify, I <em>want</em> to use something like ant + cruise control, but I can't even get the unit tests to run <em>at all</em> outside of Eclipse.  I say "something like" because there are other technologies that accomplish the same thing, and I am not so picky as to discard a solution that works just because it's using say, Maven or Buckminster, if those technologies make this substantially easier.</p>
  
  <p><em>Edit2:</em> The 'Java Result 13' mentioned above seems to be caused by the inability to find the coretestrunner.  From the log:</p>
  
  <pre><code>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.
  </code></pre>