Tomek, On Mon, 2009-08-03 at 20:51 +0200, Tomek Kaczanowski wrote: > Hi Russel, > > I don't know the answers to your questions, on the contrary I'd like > to ask you one. :)
No problem.
> > I am increasingly of the view that this way of compiling and running the
> > tests is the wrong way of doing things -- even for unit tests. I think
> > the artifact should be made and the tests compiled and run against that.
> Could you explain what would be the benefit of this ? Could you give
> an example when such testing is able to reveal more bugs then the
> testing done on the compiled classes dir ?
I think I tend to mix what some might label unit tests and integration
tests into the collection "tests" -- mostly because there is no option
but to do this. With the rise of OSGi, jars are no longer just
containers of compiled files, there is reprocessing of material. This
means it is not clear that the compilation of tests against a directory
of compiled classes is the same as compilation of the same tests against
a jar. Indeed the very fact of compiling against a jar instead of a
directory of class files changes the act of compilation. To test in the
same context as a jar is used requires that tests be compiled against
the jar.
The particular incident that is vexing me at the moment is the testing
of "gant -v". Running the tests when compiling against a jar delivers
success, running the test when compiling against a directory of class
files delivers failure. The reason is that the version number of Gant
is stored in the manifest of the jar.
From what I can see Ant and Gant can handle this easily. Maven, and I
suspect Gradle, are not able to properly separate unit tests that can be
compiled against the directory of class files instead of the jar because
the result is guaranteed to be the same, from what are really
integration tests that are coded as unit tests because there is no other
option.
If Maven and Gradle had:
src/main
src/unittests
src/integrationtests
life would be much clearer. Unit tests would be compiled and run
against the directory of compiled classes prior to packaging.
Integration tests would be compiled and run against the artifact(s).
The problem in Maven is that the directory of compiled classes seems
always to be included in the compilation and execution of tests even in
the integration-test phase. This is most worrying, and totally
irritating.
I should also note that Eclipse and IntelliJ IDEA are unable to handle
integration tests just as Maven is.
From my point of view, Gradle could get a huge win by handling this
distinction between unit test and integration test directly in the
conventional lifecycle.
--
Russel.
=============================================================================
Dr Russel Winder Partner
xmpp: [email protected]
Concertant LLP t: +44 20 7585 2200, +44 20 7193 9203
41 Buckmaster Road, f: +44 8700 516 084 voip: sip:[email protected]
London SW11 1EN, UK m: +44 7770 465 077 skype: russel_winder
signature.asc
Description: This is a digitally signed message part
