How to ignore particular scenario in cucumber?

2020-02-23 06:38发布

  1. I am using cucumber to feed scenario and java as a language.
  2. I need to ignore particular scenario, while running an automation test.
  3. I have tried with below @ignore syntax, it doesn't work at all.
  4. It doesn't skip particular scenario, it keeps on executing all the test scenario, which I have feed in the feature file.

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

7条回答
该账号已被封号
2楼-- · 2020-02-23 07:01

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:

  • old style : cucumber --tags ~@ignore
  • new style : 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.

查看更多
登录 后发表回答