buildr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Assaf Arkin <ar...@intalio.com>
Subject Re: Where do we put specs: src/test or src/spec?
Date Fri, 22 Feb 2008 18:24:12 GMT
On Feb 22, 2008, at 8:50 AM, Matthieu Riou wrote:

> I'd go for src/test because, even if specs are changing the way we  
> test,
> it's still test. If tomorrow a new nice testing library comes up  
> with new
> testing concepts are we going to create its own src/foo directory as  
> well?

BDD is significant, it's not another test framework that does thing  
slightly different than the previous one, and these conceptual  
evolutions don't happen frequently.  Not every other month, not even  
very other year, that I'm just not worried about potential namespace  
pollution.


BDD is significantly different from TDD.  First, you write a  
specification of how the software behaves.  Then you fill it up with  
test case that run against the implementation.  Then you write the  
implementation to pass the tests.  TDD does only two out of these three.

I can tell you that 'local task should execute task for project in  
local directory' because we have a specification that says exactly  
that (build_spec.rb, line 21).  If the local task doesn't execute for  
project in local directory, then the code is wrong and the test is  
wrong (for not revealing it), but the spec is still right.  So you  
patch the test, and you patch the code to pass the test, but you don't  
patch the spec.  The spec is the behavior we agreed upon.

That is a significant different from unit tests.  Unit tests have  
code, which may be wrong, and tests which may also be wrong, and  
nothing that you can rely on to express what the right thing is.

When 1.3 comes out, we'll have one page on the Web site with the  
formal Buildr specification generated from the files in the spec  
directory.  If the specs, code, tests and docs are in conflict, the  
spec is always right.  If we don't like the behavior, we change the  
spec, but until we do that, the spec is right even if the tests are  
wrong.

So there's is a significant difference between TDD and BDD, they're  
not just two different ways to write test cases.  One writes formal  
specifications, the other doesn't.

Assaf

>
>
> Matthieu
>
> On Thu, Feb 21, 2008 at 1:20 PM, Victor Hugo Borja <vic.borja@gmail.com 
> >
> wrote:
>
>>> Another one to
>>> look at is JBehave, although I can't tell if they have any
>>> conventions for directory structure.
>>
>>
>> Haven't used JBehave, IIRC the
>> jbehave.rb[1]<
>> https://issues.apache.org/jira/secure/attachment/12376069/ 
>> jbehave.rb>from
>> John Layton just searches for *
>> Behaviour.class, compiled from src/test/java
>>
>> [1] https://issues.apache.org/jira/browse/BUILDR-49
>>
>> --
>> vic
>>
>> Quaerendo invenietis.
>>


Mime
View raw message