On Mon, Aug 31, 2009 at 5:57 AM, Richard Bibb <richard.b...@aimhedge.com>wrote:

>
> I'm not running separate sql during test and real. My problem comes from
> the
> fact that I'm trying to use iBatis to set my test data up proior to running
> the real code. (i.e. in the @BeforeClass part of my unit test). The issue I
> have is that during testing the resources seem to get loaded from
> src/test/resources and when running normally from src/main/resources. This
> means that the .xml files for the "real" code do not seem to be seen when I
> run my tests
>
>
Can you paste your pom.xml? I only have my mapper.xm files in
src/main/resources/ and they are read fine by main src daos during tests.
I'm no maven expert so I 'think' (and someone correct me if I'm wrong), your
src/main/resources always get compiled into your main classes directory
(even during tests.) The test/resources are available on the classpath
during testing but are obviously not compiled into your final build.

Are you absolutely certain that it's the xml file it's not finding and not
something else? To prove it's the xml it's not finding, take one of your xml
queries and make it as annotation on the Mapper class select itself. The run
your test that calls a dao that uses that mapper.

I think it'll help if you paste a screen shot of your exploded directory
structure and your pom.


> It's quite possible that I have something wrong here in my configuration.
> Maybe a better question would have been "How do you unit test your iBatis
> code if you use Maven?"
>
>
I just create some Test classes that call my service classes or daos that
are part of the src/main tree and they work. If you need more help let me
know.

Reply via email to