Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I set up a test project for a Eclipse plugin project

I'm working on a eclipse plug-in and I've tried to create another test project seperate from the plug-in. The reason I do this is to not let the plug-in depend on jUnit when it is exported. However, I can't access the Eclipse Plug-in API when I do the testing. Whenever I try to add Plug-in dependencies the import list to that is empty.

Does anyone know how to import Eclipse plug-in API to an existing project? The workspace layout looks like this at the moment:

+- com.foo.myplugin
|     |
|     +- JRE System Library
|     |
|     +- Plug-in Dependencies
|     |
|     +- src
|     |
|     +- icons, META-INF, plugin.xml, etc...
|
+- com.foo.myplugin.test
      |
      +- JRE System Library
      |
      +- JUnit 4
      |
      +- src
like image 618
Spoike Avatar asked Oct 29 '08 08:10

Spoike


People also ask

How do I create a test class in Eclipse?

Creating a JUnit Test Case in Eclipse java file in your project that will test one of your existing classes. In the Package Explorer area on the left side of the Eclipse window, right-click the class you want to test and click New → JUnit Test Case. A dialog box will pop up to help you create your test case.


1 Answers

The recomended way of ding this seems to be with Plug-in fragments:

http://rcpquickstart.com/2007/06/20/unit-testing-plug-ins-with-fragments/

The fragment gets a high-degree of access to your plugin's code and separates the testing logic / dependencies from the plugin itsself.

Now if only I could find a way to test them in an automated system... (see: Automating unit tests (junit) for Eclipse Plugin development )

like image 169
rcreswick Avatar answered Oct 11 '22 07:10

rcreswick