buildr-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lacton <>
Subject Re: [buildr] Order of classpath for running tests
Date Fri, 27 Jun 2008 17:54:22 GMT

I agree with you this risk exists.

Personally, I try to use this kind of overriding mechanism as little
as possible. I find it somewhat confusing to have two different files
with exactly the same name. Relying on this, for me, is a design

Yet, when working with existing code, it can be an efficient way to
start writing tests. Michael Feathers wrote extensively about it in
Working Effectively with Legacy Code.



On Fri, Jun 27, 2008 at 7:15 PM, Assaf Arkin <> wrote:
> Thinking about this a bit more.
> If test stuff comes first in the classpath, then tests can override
> any file with the same name, could be configuration file, resource
> file, even class implementation (e.g. to add tracing and debugging).
> So there's obviously a benefit for this feature.
> But if test stuff comes first in the classpath, it could override any
> file with the same name, and you end up testing with the wrong file.
> You might get the tests to pass by fixing the test file, but not the
> original file that everyone else uses.
> I have not seen a lot of instances of that happening, so I think the
> utility of having tests override files with the same name, is
> worthwhile doing.  Just wanted to make sure we realize there's a
> downside to this.
> Assaf
> On Thu, Jun 26, 2008 at 9:33 AM, lacton <> wrote:
>> Assaf,
>>>> The problem is that 'target/test/resources' comes after
>>>> 'target/resources'. My tests are seeing the wrong property file.
>>>> How would you tackle this issue?
>>> test.with
>>> this would add test.resources earlier in the classpath.
>> Thank you. It now works exactly as I wanted.
>>> Separately, I don't remember paying attention to this, so maybe we
>>> talk about what the right order should be, and if we're doing it
>>> wrong, file an issue and fix it.
>> I created issue BUILDR-88.
>>> Would it be better for test classes/resources to come before compile
>>> classes/resources so they load up earlier in the classpath?
>> I think it would make sense, as it's the way maven works.
>> Cheers.
>> --
>> Lacton

View raw message