JUnit Plug-in testing [message #1717755] |
Wed, 16 December 2015 14:15 |
|
Dear list,
I am running JUnit tests inside the Eclipse OSGi pool (with bundle contexts, OSGi components, etc.) is by using the JUnit Plug-in Test run/debug configuration type.
Is this the good approach for enabling functional JUnit tests in my Eclipse application?
Thanks,
-Piero
|
|
|
|
Re: JUnit Plug-in testing [message #1717835 is a reply to message #1717755] |
Thu, 17 December 2015 08:26 |
Jonas Helming Messages: 699 Registered: July 2009 |
Senior Member |
|
|
Yes! However, I would recommend to do plain JUnit tests whereever
possible. OSGi test are slower and require more maintenance, e.g. you
have to maintain the run config and the tycho config.
As an example, if you want to test OSGi services, which depend on each
other, you can simply instanciate and wire them manually in plain JUnit.
This way, you have full control on which components are used and which
are mocked.
I would recommend to use OSGi for integration tests only and test the
behavior mainly with plain JUnit tests. This will typically also improve
your architecture as it makes your components less dependent on OSGi.
Best regards
Jonas
Am 16.12.2015 um 15:15 schrieb Piero Campalani:
> Dear list,
>
> I am running JUnit tests inside the Eclipse OSGi pool (with bundle
> contexts, OSGi components, etc.) is by using the JUnit Plug-in Test
> run/debug configuration type.
>
> Is this the good approach for enabling functional JUnit tests in my
> Eclipse application?
>
> Thanks,
> -Piero
>
--
--
Jonas Helming
Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
|
|
|
Re: JUnit Plug-in testing [message #1717854 is a reply to message #1717835] |
Thu, 17 December 2015 11:49 |
|
Dear Jonas,
Thanks for your very welcome opinion.
I'm not sure I understand how I can achieve it anyway..
Many bundles here which depend on having the Eclipse context in order to resolve resources like properties files, configuration files, icons, etc.
So essentially my services break when their bundle activator provides no context.
Any further suggestion?
Thanks a zillion,
-Piero
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04012 seconds