buildr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Assaf Arkin <ar...@intalio.com>
Subject Re: Running a test suite against Buildr with Cucumber
Date Wed, 18 Feb 2009 20:50:26 GMT
On Wed, Feb 18, 2009 at 11:34 AM, Ketan Padegaonkar <
ketanpadegaonkar@gmail.com> wrote:

> Antoine pointed out to a hidden gem[1] that allows running a scenario in a
> controlled 'world'.
>
> All we needed to do was:
>
> World do |world|
>  world.extend(SpecHelpers)
> end
>
> Our specs[2] now run fine and we hope to post our experiences with buildr.


BDD is about software design. You start out by specifying how your software
should behave, then fleshing out ways to test these specifications, and then
writing code that behaves according to that specification.

Sometimes you just need to make a lot of statements, like "should not
compile project with no source files" or "should skip tests when test=no".
 These are called specs, and are at about the same level of abstraction as
unit tests.

Sometimes you need to write our more elaborate, multi-step scenarios, like
your classical "I log in. I add product to cart. I check out. I confirm
payment. I receive an invoice". These are called scenarios or stories, and
they deal with broader designs that would be lost if reduced to specs.

The very short example [1] looks more like specs then scenarios. Also
overusing of the define shorthand will lead to overuse of conjunctions [2].
And when you have something that's possibly a conjunction ("containing") in
50% of your scenarios, might be sign you're using the wrong framework.

Assaf


[1]
http://github.com/ketan/buildr4eclipse/blob/9c785b548acad5adc3efbb5555f07f61df94f7c9/features/my.feature
[2]
http://wiki.github.com/aslakhellesoy/cucumber/conjunction-steps-antipattern


>
>
> [1] http://wiki.github.com/aslakhellesoy/cucumber/a-whole-new-world
> [2]
> http://github.com/ketan/buildr4eclipse/blob/9c785b548acad5adc3efbb5555f07f61df94f7c9/features/step_definitions/steps.rb
>
>
> -- Ketan
>
>
>
> On 18/2/09 23:51, Antoine Toulme wrote:
>
>> I am wondering, are we missing the equivalent of this ? (at the end of
>> spec_helpers.rb)
>>
>> Spec::Runner.configure do |config|
>>     # Make all Buildr methods accessible from test cases, and add various
>> helper methods.
>>     config.include Buildr, SpecHelpers
>>
>>     # Sanbdox Buildr for each test.
>>     config.include Sandbox
>>   end
>>
>>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message