Hi Kenney

On 9/4/06, Kenney Westerhof <[EMAIL PROTECTED]> wrote:
There are 2 classloaders created - one for surefire itself, containing
surefire code and the testing framework; the second one contains only
the test dependencies from the POM.

If your annotations can't be found, they're missing from the project test
path. Or the two classloaders described above aren't linked.

I can confirm that it doesn't look so easy. It someway works when
using the system classloader, but it currently fails with any other
combination. The usual result is that surefire can't find tests (if
the annotation class is loaded by both classloader or only from the
test classloader) or also a ClassNotFound exception when testng is
loaded only by the project classloader.

If it worked before, it shouldn't have, because the root classloader shouldn't
contain the testng annotations.

I agree, it sholdn't... but as said I could not find a different
solution to make it work too.

Could you provide a unit test?

At the moment you can run integration tests in maven-surefire-plugin
for a quick spin.

You can try running mvn test on maven-surefire-plugin/src/it/test8 for example.

At the moment it works, the result is:
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.03 sec

... if you remove the root classloader the result is:
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.041 sec
(note that it will not fail... if you have any suggestion on how to
check this result please give us a hint)

Another strange thing that I noticed is that at the moment tests are
only found in projects which depends on TestNG 5.1 (the same version
used in the surefire provider).
maven-surefire-plugin/src/it/test6 is exactly the same as test8 but
declares a dependency on TestNG 5.0.1 and it doesn't work

fabrizio






-- Kenney

Jesse Kuhnert wrote:
> Applying the patch mentioned has made running annotation based testng tests
> b0rken. Ie before it was loading classes using a context of system class
> loader. I've fixed this locally by calling createClassLoader(classpathurls,
> childdelegation, true) (which uses system class loader by default) instead
> of createClassLoader(classpathurls, null, childdelegation, true).
>
> The recent application of old patches is definitely appreciated, but things
> like this make me nervous for the future. There ~has~ to be a reasonable
> way
> to run unit tests against surefire that assert things aren't broken...The
> logic of classloader dependencies is too fragile to not have tests...
>
> Sorry, I shouldn't be telling you guys what to do..
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to