On 22 Oct 2009, at 23:23, Mike Sassak wrote:
>
> On Thu, Oct 22, 2009 at 6:02 PM, Richard Lawrence
> <
ric...@humanizingwork.com> wrote:
>>
>> Bare scenarios are used in Cucumber's own tests (when simple feature
>> files are generated), and I do the same in my Cuke4Nuke tests. On
>> other projects, I've always used a Feature at the top.
>>
>
> Discovering that bare scenarios were used within Cucumber itself was
> what prompted me to send the email, actually. There are a few options
> to continue testing with bare scenarios and Gherkin, (some of which
> are even kind of elegant!), but if many people use bare scenarios in
> production, it might make more sense to just change what Gherkin
> recognizes as valid syntax. If not, then the workarounds should be
> fine.
I'm going to be surprised if we find very many people who are
currently using features that don't begin with a "Feature: Feature
Name" line, but I'd suspect that's because the examples and tooling
(e.g. TextMate bundle) very much push you down that path. Few people
have probably even realised it is possible to miss out this line and
as Aslak said, it's only really an accident that it is. However, just
because not many people are using it doesn't necessarily mean we
should close out the option.
I've always thought of Features within Cucumber as just a fairly
arbitrary way to group Scenarios together. I often split a feature
file when it starts to contain too many Scenarios, or move a Scenario
around from one feature file to another. They're definitely a useful
way to help organise scenarios, but other mechanisms like tags are
also useful.
I personally think think of the Scenario as the heart of the model,
which might or might not be contained by a feature:
http://yuml.me/diagram/scruffy/class/[Step]0..*-1[Scenario],
[Scenario]0..*-0..1[Feature]
I confess haven't looked at the Gherkin parser at all yet, but if it
were possible for it to be able to interpret Gherkin text in this way
- looking for features if they're there but not insisting on it, I
think we'd have a better (and more flexible) model.
Having said that, if this would make the Gherkin parser much more
complex, I think we can fix up the few places in Cucumber where we are
taking advantage of this and just add the "Feature: Foo" line.
cheers,
Matt
http://mattwynne.net
+447974 430184