What is the standard way (following all naming conventions) to set up an eclipse plugin project consisting of only one plugin. My plugin-project is called com.florian.regexfindandreplace
. Right now I do the following: I have a feature project com.florian.regexfindandreplace.feature
that contains solely above plugin. Then I have another project called com.florian.regexfindandreplace.product
, that hosts a product file of my plugin. The product I need for JUnit Plug-in tests because in the launch configuration I need to set the option Run As product (see http://www.vogella.com/tutorials/SWTBot/article.html#swtbotexample_launchconfiguration).
Now I don't know where to place my tests. If I put them in the source folder of the com.florian.regexfindandreplace
project, I need to add a lot to the required bundles in MANIFEST.MF only needed for testing purposes (such as org.eclipse.swtbot.swt.finder
). So I want to avoid this.
Currently, my idea is to have another plugin project com.florian.regexfindandreplace.tests
that adds everything of SWTBot to its required bundles in MANIFEST.mf. However, because I don't want com.florian.regexfindandreplace
to export any packages, I link the source folder of that plugin in the test plugin project (which seems a bit ugly though). In my test project I add also all the sources for JUnit tests, JUnit SWTBot tests and JUnit Plugin-tests.
But is there a standard way to set up such a plugin project? What did you do for your plugin projects?
Usually plug-in tests are put into a fragment whose host bundle is the plug-in that contains the code under test. At runtime, the fragment is merged into the host bundle and therefore has full access to the classes of the host bundle. There is no need for the production code plug-in to export unwanted packages. The dependencies on test libraries are specified in the fragment so that the production code plug-in is free of test dependencies.
See also here http://www.modumind.com/2007/06/20/unit-testing-plug-ins-with-fragments/