Version 1, last updated by Daniel Ratiu at Dec 15 09:15 2011 UTC

Testing plugin features with JUnit

Testing the plugin continuously and automatically is a safety belt for its evolution. Since most of the plugin features are deeply integrated with the eclipse, testing them requires an eclipse instance up and running.

The class "scala.tools.eclipse.EclipseUserSimulator" contains a small API to simulate the working of an user with Eclipse. This API is incomplete, but it already enables to simulate a series of user actions like: creating a new Scala project in the workspace, creating a package, adding a ".scala" source file, changing its content and saving the changes, performing a build, etc. 

Currently there is a single test case that uses this API, "scala.tools.eclipse.ScalaSourceFileEditorTest". To run this test you should do the following steps:

  1. Run -> Run configurations ...
  2. New "JUnit plug-in test"
  3. Set "Test class" -> "scala.tools.eclipse.ScalaSourceFileEditorTest"
  4. Switch to the "Configuration" tab and use the same "config.ini" as by the normal run of the workbench
  5. Press the "Run" button ... :-)