Feature File
@ActivateSegment Feature: Test for Activate segment Scenario: Login Given I navigate to M And I enter user name And I enter password And I login to MM Scenario: Open grid Given I choose menu And I choose Segments menu Scenario: Open segment creation page Given I click on New button And I click on Segment button
Thats what its supposed to do. Cucumber is not designed to allow you to skip steps and continue, because generally scenarios don't make sense when you skip steps.
You can ignore or skip Cucumber Tests using tags. This works both for Scenario as well as Feature. You can skip a scenario, set of scenarios or all scenarios in a feature file. You can also use this with conjunction with AND or OR.
Cucumber skips all steps after a failed step by design. Once a step has failed, the test has failed and there should be no reason to perform the next steps. If you have a need to run the additional steps, likely your scenario is testing too many different things at once.
OR logic is like this: tags = {"@Tag1, @Tag2"} //one of these Tags must be present or: tags = {"~@Tag1, ~@Tag2"} //one of these Tags must not be present, the Rest will be executed!
Use tag ~@tag_name
To exclude scenarios with a certain tag
cucumber --tags ~@tag_name
Note I used ~
symbol.
One thing to note here is that Cucumber will exit with a status of 1 if your @wip-tagged scenarios pass (it’s a reminder that they’re not works in progress anymore since they pass).
@billing Feature: Verify billing @important Scenario: Missing product description Scenario: Several products
cucumber --tags @billing # Runs both scenarios cucumber --tags @important # Runs the first scenario cucumber --tags ~@important # Runs the second scenario (Scenarios without @important)
Offical document: https://github.com/cucumber/cucumber/wiki/Tags
According to Cucumber.io there are 2 styles in which a tag expression can be defined. For your specific case, to exclude steps or features marked with @ignore, these 2 styles translate into:
cucumber --tags ~@ignore
cucumber --tags "not @ignore"
.To my surprise, using the same cucumber-js v1.3.1 running on Node.js v6.9.2, I found that the Windows version accepted only the new style, while the Linux one accepted only the old style. Depending on your setup, you may want to try both and see if you succeed with any of them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With