Skip to content
This repository has been archived by the owner on May 28, 2019. It is now read-only.
msassak edited this page Jun 20, 2011 · 4 revisions

Rules for writing "global features"

1. Implementation-independent

Global features should run without modification on any Cucumber implementation. This naturally leads to a common practice: avoid implementation details to surface in features and move them down to the step definitions.

2. No step definition

No step definition is to be stored in cucumber-features. Those are kept within each implementation project.

3. Step definition documentation

All step definitions required to run the global features must be well documented. Their expected behaviour, the parameters they accept and their failing cases should all be clear and explicit. See Global Step Definitions Specifications.

4. Style

The features are written in a "balanced" way. No step definition code is included anymore (compared to original Cucumber.rb features) but feature sources are. Have a look at different levels of abstraction that were suggested. The syntax illustrated on example #2 was chosen.

5. Core feature elements are enough

core.feature tests support for "Feature", "Scenario", steps, step parameters, DocStrings and of course step invocation. That's basically all that is needed to start doing useful things with the Cuke.

Any implementation passing that particular "first" feature should be able to run the whole global feature set to test/develop itself. It means that every global feature must stick to those "core" elements and cannot include anything else than that.

That way, any fresh implementation passing that very feature is able to run the set against another instance of itself without failing because it would be lacking support for a particular "advanced" feature element (e.g. backgrounds, scenario outlines, tags, etc.).