使用下面这行代码,可以执行 login.feature 中提到的所有场景。
@CucumberOptions(features= "src/main/resources/publish/login.feature", format = {"pretty"} )
Run Code Online (Sandbox Code Playgroud)
如果我必须执行多个特征文件,我该如何定义?假设我定义如下,发布文件夹中提到的功能将被执行。
@CucumberOptions(features= "src/main/resources/publish", format = {"pretty"} )
Run Code Online (Sandbox Code Playgroud)
如果我必须在其中运行多个功能和场景,我该如何定义?我必须创建多个cucumberRunner类还是可以在一个类文件中定义。
小智 4
您可以通过在 cucumber 选项中定义标签值来完成此操作(考虑到您已经将这些场景分组到功能文件中)
例如:features=“src/test/resources/FeatureFiles”,tags=“@feature1scenariogroup1,@feature2cenariogroup2”
在功能文件内定义标签:
Feature: My Feature File
@smoke
Scenario: Login
Given I open "FireFox" browser
When I navigate to Sectionone "Home" page
And i do something
Then I Validate Something
@regression
Scenario: Compose Email
Given I open "FireFox" browser
When I Do An Action
@OnlyOneTime
Scenario:Send Email
....
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
59116 次 |
最近记录: |