Problem was in fact that test from one module was referencing a test
resource from other module of the same maven multi-module project. I'm not
sure whether it is a bug in TestNG or m2eclipse eclipse integration, but it
enabled test, which was failing in Maven, to run successfully from TestNG
eclipse plugin.

Regards,
Stevo.

On Fri, Sep 12, 2008 at 3:06 PM, Stevo Slavić <[EMAIL PROTECTED]> wrote:

> Hello all,
>
> This is my first post to maven-users mailing list, and from the start, I'm
> here to brag about my problems with maven.
>
> I'm having a problem with a TestNG test which runs successfully in
> Eclipse(3.4) TestNG plugin(5.8.02), but in Maven (2.0.9) Surefire (2.4.3)
> same test fails. It's a spring(2.5.5)-based integration test, it extends
> AbstractTestNGSpringContextTests, and through @ContextConfiguration
> annotation and its locations attribute it gets configured to load 3 context
> files, two of them referenced as "classpath:/com/...." while third one is
> from a dependent project/library (test is in one module [war] which depends
> on another module [jar] from same multimodule project [pom]) and is
> referenced using "classpath*:/com/....." .
>
> Among other things, test makes use of a bean (well) defined in that third
> (classpath*) context file. That referenced bean is injected to the test
> through use of autowiring (@Autowired). Problem is that that bean doesn't
> get found and test initialization fails. Log doesn't print that problematic
> context failed to load, just any of it's beans aren't accessible/registered.
> Btw, if I leave out * from classpath* spring reports that it couldn't load
> context file as it is missing.
>
> I've tried substituting autowiring with getting bean by name "manually" in
> setUp method through this.applicationContext.getBean but this also failed.
>
> Then I've thought that it has to do with loader used to load context's, so
> I explicitly specified loader attribute of @ContextConfiguration annotation
> to be GenericXmlContextLoader.class. This didn't work either. In all of
> these tweaks, test would continue to run well in eclipse testng plugin, but
> it fails in maven (both external and m2eclipse internal).
>
> Because I use reportng, I though it interfered with the test somehow but
> removing reportng didn't help as well as removing parallel mode for test
> execution.
>
>
> With this I ran out of options, with you guys being my last resort. Any
> comments and pointers are welcome!
>
> Thanks in advance!
>
> Regards,
> Stevo.
>

Reply via email to