Cucumber cumberjvm:如何在before钩子中为另一个特性运行场景
我有一个功能文件,其中包含在特定工具中创建回购的场景。出于安全原因,我已注释掉某些项目。这并不重要Cucumber cumberjvm:如何在before钩子中为另一个特性运行场景,cucumber,Cucumber,我有一个功能文件,其中包含在特定工具中创建回购的场景。出于安全原因,我已注释掉某些项目。这并不重要 @CreateRepo场景测试创建回购的步骤 @CreateBranch场景测试创建分支的步骤 如下所示,@CreateBranch在创建回购的场景开始时重复所有相同的步骤。它看起来很难看,而且重复了步骤 我希望能够在CreateBranch的step defs文件中的before钩子中运行@CreateRepo,而不必重复创建repo的所有相同步骤。这可能吗 功能文件1: Featur
场景测试创建回购的步骤@CreateRepo
场景测试创建分支的步骤@CreateBranch
- 如下所示,
在创建回购的场景开始时重复所有相同的步骤。它看起来很难看,而且重复了步骤@CreateBranch
- 我希望能够在CreateBranch的step defs文件中的before钩子中运行
,而不必重复创建repo的所有相同步骤。这可能吗@CreateRepo
功能文件1:
Feature: Create a repository in {hidden}
Background:
Given I sign into {hidden} on 'node1' as the 'root' user using password: 'password'
@CreateRepo
Scenario: Administrator creates a new repository through {hidden} UI.
When I click on the {hidden} icon on the Navigation bar
Then I should be on the {hidden} page
When I create a public project called {hidden}
Then the repo {hidden} should be {hidden content}
Then On 'node1' I follow the steps for creating a new repository
When I clone {hidden} to 'node2'
Then I check {hidden} on 'node2' has branch 'master'**
功能文件2:
Feature: Create a branch for a project in {hidden}
@CreateBranch
Scenario: Administrator creates a new repository through {hidden} UI.
When I click on the {hidden} icon on the Navigation bar
Then I should be on the {hidden} page
When I create a public project called {hidden}
Then the repo {hidden} should be {hidden content}
Then On 'node1' I follow the steps for creating a new repository
When I clone {hidden} to 'node2'
Then I check {hidden} on 'node2' has branch 'master'**
When I click on the '{hidden}' link
And I click on the '{hidden}' link
When I select '{hidden}' from the {hidden} list
And I click on the '{hidden}' for {hidden} button
When I click the '{hidden}' button on {hidden} page
Then I should be on the '{hidden}' page
要素文件2的步骤定义文件:
@Before("@CreateBranch")
public static void beforeCreateBranch() throws Exception{
//Run @CreateRepo scenario somehow...
}