to be clear - if you have code that is completely independent of osgi and has no dependencies you'll have to maintain twice then
do by all means run those tests outside tycho.

We do that already today - they just don't have any tycho at all in them. i.e. hibernatetools-core are plain java tests which we then include in the plugin.

Is that the situation you are having ?


On 01/27/2016 10:28 AM, Aurelien Pupier wrote:


Hi Aurelien!

Did I misunderstood something?
Are there counterpoints to use fragments and maven-surefire-plugin?
Are there other examples which are matching more closely to my usecase
in jboss tools codebase?

About using fragments, the only drawback I'm aware of is that one cannot add a dependency to a fragment from their plugin. So it's not possible for other tests to reuse some logic that is inside a fragment. In the spirit of "treating tests as 1st class citizen", I believe it's generally better to allow composition of test bundles and to make them regular bundles.

About maven-surefire (plain Java) vs tycho-surefire (OSGi/Eclipse), so far, we do not test the code of JBoss Tools outside of the "Eclipse" context. We can debate about the meaning of "unit tests", but what you see can be seen as "unit tests running in integration context". Our experience with some other parts of JBoss Tools have been that the difference of behavior between inside or outside of Eclipse can be important. So our policy has been so far to test everything with tycho-surefire-plugin to make sure what we're testing isn't too far from what will actually happen in production.
The QE people could tell you their opinion on what's more important between fast tests, and longer tests that are closer from production.
I guess it all depends, as always: we could imagine the unit test running in plain Java to verify only their logic, but it shouldn't become a replacement to some integration test to verify that the logic also works in the right context.
I would say that as long as Eclipse is the only deployment context for a piece of code, then starting unit tests inside Eclipse is fine. Also, for fast unit tests, then they are neglictable compared to starting up the OSGi Platform. So if we want to start an OSGi platform anyway for integration tests, it seems simpler to run those tests inside that Platform.

Mickael Istria
Eclipse developer at JBoss, by Red Hat
My blog - My Tweets

jbosstools-dev mailing list