Skip to content

Instantly share code, notes, and snippets.

View gsmendoza's full-sized avatar

George Mendoza gsmendoza

View GitHub Profile
@gsmendoza
gsmendoza / 2012-08-24-isolated-cucumber-tests-with-local-steps.markdown
Created August 8, 2012 06:16
A workaround for isolated tests with local steps in Cucumber

A workaround for isolated tests with local steps in Cucumber

I've always wanted to write tests using Spinach. Unlike Cucumber, steps in Spinach are local to the feature they are defined. Therefore, they do not conflict with step definitions in other features.

However, we're using Cucumber in our project. The Cucumber way doesn't allow steps local to a scenario. In fact, it even considers it an anti-pattern.

Last week though, I had an idea: why not stamp each step with a scenario ID so that the step is local to the scenario? Using the spinach example, I ended with something like this:

features/1_greetings.feature