lambdaisland / kaocha-cucumber

Cucumber support for Kaocha
Eclipse Public License 1.0
38 stars 11 forks source link

Way to have "default steps"? #5

Closed zilti closed 4 years ago

zilti commented 4 years ago

We're considering using kaocha-cucumber for browser testing of our project. Since that means there are, no matter which feature, a lot of similar steps, I wonder if there is a way to define "default" steps that will be used when none is defined in the specific namespace. Like e.g. "If I click on the element with id {string}" is something we would use in many feature files, and this would otherwise mean to have duplicate code.

plexus commented 4 years ago

Would (Before ...) hooks or Background: blocks do the trick?

zilti commented 4 years ago

Not really, no... Maybe I am thinking too low-level? But a step like "And I click on the element with id {string}" can be used across many features, which it seems would mean that I have to define it anew in every feature using it.

Backgrounds also are restricted to one feature each, and a Before block is executed at the beginning of every scenario of a feature, if I understood that correctly.

plexus commented 4 years ago

Then I'm afraid I can't help you

zilti commented 4 years ago

Thanks nonetheless! And we are actually using kaocha-cucumber for our software now.