|
Re: writing JUnit tests to verify extension points? [message #307738 is a reply to message #307737] |
Tue, 29 August 2006 20:58  |
Eclipse User |
|
|
|
Originally posted by: wharley.bea.com
"Liam Morley" <liam.morley@baesystems.com> wrote in message
news:ed2mce$e89$1@utils.eclipse.org...
> I've just created an extension point, and now I'd like to write a JUnit
> test to verify that it works. I thought I would create a class that
> extends my extension point and then verify that I can see it using the
> method described at
> http://wiki.eclipse.org/index.php/FAQ_How_do_I_find_all_the_ plug-ins_that_contribute_to_my_extension_point%3F.
> The problem is, if I do that, my JUnit test will depend on this dummy
> project. Is there any way I can extend my extension point
> programmatically? Or do I have to create a new project and extend the
> extension point there?
Best way is to have one plug-in project that is your intended functionality,
and another plug-in project that extends your extension point and contains
JUnit tests. In fact you may want to simply put all your JUnit tests in
that second project, so that you don't burden your shipping plug-in code
with test code. That's how Eclipse itself mostly works: if you look in CVS,
you'll see lots of org.eclipse.foo.tests plug-ins, that test the
corresponding org.eclipse.foo plug-ins.
One reason for this is that there is a longstanding bug in Eclipse
(https://bugs.eclipse.org/bugs/show_bug.cgi?id=109137) that means that if
you launch a debug Eclipse instance on a plug-in project, projects within
the debug instance won't be able to see the classes in the project. That
is, the code for the project being launched will be *executed* in the debug
instance, but it won't be *visible* to other projects within the debug
instance. That in turn means that your test dummy project would not be able
to see the code that it is supposed to extend.
|
|
|
Powered by
FUDForum. Page generated in 0.24499 seconds