sel*_*lvi 21 java automation cucumber
特征文件
@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
Run Code Online (Sandbox Code Playgroud)
Ara*_*vin 22
使用标签 ~@tag_name
排除具有特定标记的方案
cucumber --tags ~@tag_name
Run Code Online (Sandbox Code Playgroud)
注意我使用了~符号.
这里需要注意的一点是,如果你的@ wip-tagged场景通过,Cucumber将以状态1退出(这提醒他们,自从它们通过后它们不再正在进行中).
@billing
Feature: Verify billing
@important
Scenario: Missing product description
Scenario: Several products
Run Code Online (Sandbox Code Playgroud)
cucumber --tags @billing # Runs both scenarios
cucumber --tags @important # Runs the first scenario
cucumber --tags ~@important # Runs the second scenario (Scenarios without @important)
Run Code Online (Sandbox Code Playgroud)
官方文件:https://github.com/cucumber/cucumber/wiki/Tags
M. *_* F. 14
根据Cucumber.io,有两种样式可以定义标记表达式.对于您的特定情况,要排除标有@ignore的步骤或功能,这两种样式将转换为:
cucumber --tags ~@ignorecucumber --tags "not @ignore".令我惊讶的是,使用在Node.js v6.9.2上运行的相同的cucumber-js v1.3.1,我发现Windows版本只接受新样式,而Linux版本只接受旧样式.根据您的设置,您可能想要同时尝试两者,看看您是否成功了.
Ran*_*ili 13
*.特征
@skip_scenario
Scenario: Hey i am a scenario
Given blah blah
And blah blah blah
Run Code Online (Sandbox Code Playgroud)
CucumberHooks.java
package CucumberHooks;
import cucumber.api.Scenario;
import cucumber.api.java.Before;
public class CucumberHooks {
@Before("@skip_scenario")
public void skip_scenario(Scenario scenario){
System.out.println("SKIP SCENARIO: " + scenario.getName());
Assume.assumeTrue(false);
}
}
Run Code Online (Sandbox Code Playgroud)
Cod*_*ker 13
使用JUnit runner class和 参考https://cucumber.io/docs/cucumber/api/#ignoring-a-subset-of-scenarios
您可以创建自己的忽略标签
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
import org.junit.runner.RunWith;
@RunWith(Cucumber.class)
@CucumberOptions(tags = "not @ignore")
public class RunCucumberTest {
}
Run Code Online (Sandbox Code Playgroud)
然后像这样标记场景:
@ignore
Scenario: Check if all the 3 categories of cats are displayed
Given I open the Cats App
When I view the home screen
Then I should see all three cats categories displayed
Run Code Online (Sandbox Code Playgroud)