buildr-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lacton <lac...@users.sourceforge.net>
Subject Re: [buildr] Order of classpath for running tests
Date Sat, 28 Jun 2008 10:46:28 GMT
That was fast! Thank you.

I have a small improvement suggestion for the rspec part of the fix.
Instead of using a file called 'test' in spec/test_spec.rb, what about
a file called 'config.xml' or 'config.properties'? I think it would be
a better example of what is usually found in the resources directory,
just like you created java files in src/main/java/.

Regards.

--
Lacton

On Sat, Jun 28, 2008 at 2:20 AM, Assaf Arkin <arkin@intalio.com> wrote:
> Now in SVN.
>
> Assaf
>
> On Fri, Jun 27, 2008 at 10:54 AM, lacton <lacton@users.sourceforge.net> wrote:
>> Assaf,
>>
>> 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
>> smell.
>>
>> 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.
>>
>> Regards.
>>
>> --
>> Lacton
>>
>> On Fri, Jun 27, 2008 at 7:15 PM, Assaf Arkin <arkin@intalio.com> 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 <lacton@users.sourceforge.net>
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 test.resources.target
>>>>>
>>>>> 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

Mime
View raw message