【发布时间】:2012-04-24 03:17:26
【问题描述】:
我有一个功能文件
Feature: Create Profile
Scenario: Create Profile
Given I want to create a profile
When I create a profile
Then I should be navigated to Home Page
Then sign out link should exist
所以上述运行一切正常,并断言它确实回到了主页中并且存在退出链接。
现在我有了另一个功能文件。
Feature: Go to my account page
Scenario: Go to my account page
Given I want to go to my account page
When I go to my account page
Then I should be navigated to the my account page
在运行"When I go to my account page" 步骤之前,用户应该"Create Profile"。
所以我所做的就是添加了
When I create a profile
Then I should be navigated to Home Page
Then sign out link should exist
在When I go to my account page之前。
但我发现我复制了“创建配置文件”功能/场景中的相同代码。
如何在“转到我的帐户页面”场景中运行整个“创建个人资料”功能/场景?
我正在使用带有 Selenium 和 JUnit 的 cucumber-jvm。
【问题讨论】:
-
您可能需要创建一个名为
createOrVerifyProfile的方法,该方法将调用与功能CreateProfile或功能VerifyProfile关联的所有方法
标签: selenium junit cucumber cucumber-jvm