Hi everybody,
I wake up this thread because following this discussion and several point
to point discussions, I gave a presentation @ EclipseCon France about the
importance of "unit tests which are not launching the Workbench or an OSGi
platform".
Here is the recording:
On Mon, Feb 1, 2016 at 7:43 PM, Mickael Istria <mistria(a)redhat.com> wrote:
On 02/01/2016 07:25 PM, Aurelien Pupier wrote:
Le 1/27/2016 11:53 AM, Mickael Istria a écrit :
Yes, but it requires an effort in moving the code to the right plugin or
turning fragment into a bundle everytime one identifies something to reuse;
whereas using bundles only doesn't require any effort from the "producer"
side.
Considering this code as first citizen, it seems to me an acceptable
effort ;-)
Do you put your actual "first citizen" business code into fragments too?
When running locally, I may want to run only unit tests first. Without
launching the OSGi platform it will be faster. It will also allow to use
some tools such as Infinitest to have continuous feedback while developing.
I don't know much of Infinitest, but I believe it doesn't rely on how
Maven runs tests. Eclipse already provide the ability to run a test class
in a bundle in plain Java without starting the workbench; it's "Run As >
JUnit Test" instead of "Run As > JUnit Plugin Test". I guess Infinitest
can
rely on that, can't it?
Yes Infinitest can rely on it but it means that you are able to launch as
"JUnit test" and so not starting the workbench.
Yes, and if you're able to do it from the Eclipse IDE for your test class,
isn't it enough?
So in your IDE, you can run "unit tests" without the workbench/Platform
actually started, just the API available; and with Maven and
tycho-surefire-plugin, you get a Platform/workbench started, like it will
happen in real-life, to find real issues that wouldn't happen in plain Java
environment.
Just to be clear, I'm not saying it's wrong to change that; I'm more
wonderint how much profitable is it, what changing test structure would
provide better than the current one does. The Infinitest story seems the
only one "worth it" IMO, and it doesn't seem to be correlated to
tycho-surefire vs maven-surefire.
InfiniTest or only launching test of a single plugin very fast (less than
a second versus tens seconds) it is the difference between keeping
concentrated on the task and have our brain switching to another idea.
It seems to me that only tests launched with surefire will be able and
ensured - to run with Junit test.
I believe this sentence illustrates our divergence: you mainly think about
tests as a tool for the developer, and they have to be fast for the
developer to use them. That's right.
I see them as an armor for the application, I want them to find as many
bugs possible in the actual environment where the code will actually run,
and if it has a cost for the developer, so be it, as long as tests are
still run and checked by continuous integration. That's right too.
Overall, both are right and useful. Depending on the test, you might want
one or the other.
What's possible and that seems like the best thing to me is to have the
unit-tests in a bundle that run fast with maven-surefire-plugin, and have
integration tests in another bundle also running the unit-test suite (+
some other tests) with tycho-surefire-plugin. So you get the best of both:
unit tests are run fast and keep running fast because they are
automatically tested using plain JUnit and maven-surefire-plugin; and you
also have them running as part of the integration tests to also detect bugs
that depend on the Eclipse runtime mechanism.
WDYT?
--
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>
_______________________________________________
jbosstools-dev mailing list
jbosstools-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jbosstools-dev
--
Aurelien Pupier
Senior Software Engineer in JBoss Fuse Tooling team
@apupier