我对登录功能的使用有疑问。我在寻找什么:我有一个登录功能,应该与我在 Cucumber 和 Selenium 中使用的所有其他未来功能一起使用。此登录功能应与其他功能相结合。这是 mi Login.featureFeature: Login Profile As an user of Page X I want to login my profile using my credentials In order to see the default dashboard Background: User navigates to Company home page Given I am on the Company login page @wip Scenario Outline: Successful login When I fill in User ID with "<username>" And I fill in Password with "<password>" And I click on the Log In button And I should get the Second code login with "<email>" and "<pass>" And I must put the Second code in the field code for accessing Examples: | username | password | email | pass | | XXXXXXXX | YYYYYYY | ZZZZZZ@WWWWWW.com | 1234556 |我需要在不关闭 Selenium 导航的情况下将此功能与另一个新功能相结合。有人可以指导我吗?
1 回答
慕桂英4014372
TA贡献1871条经验 获得超13个赞
请参阅在 Cucumber 中,在一个功能文件中的场景/大纲下定义的步骤不能在其他功能文件中重复使用。
如果您想重用登录步骤,那么您应该在所有这些功能文件中在后台声明这些,其中所有场景都应在每个功能文件中重用在后台编写的登录步骤。
例子
Feature: Registration, Login and MyAccount
Background: User is Logged In
Given I am on the homepage
And I follow "Sign in"
@smoke
Scenario: Verify Login Functionality
When I fill "email address textbox" with "goswami.tarun77@gmail.com"
Then I fill "password textbox" with "Test1234"
添加回答
举报
0/150
提交
取消
