On 01/27/2016 10:28 AM, Aurelien Pupier wrote:
Hi,
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.
HTH
--
Mickael Istria
Eclipse developer at JBoss, by Red Hat <
http://www.jboss.org/tools>
My blog <
http://mickaelistria.wordpress.com> - My Tweets
<
http://twitter.com/mickaelistria>