亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Cucumber Java with Selenium - 重用和連接登錄功能與其他功能

Cucumber Java with Selenium - 重用和連接登錄功能與其他功能

慕田峪9158850 2023-02-16 14:16:35
我對登錄功能的使用有疑問。我在尋找什么:我有一個登錄功能,應該與我在 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  | [email protected]  | 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 "[email protected]"

Then I fill "password textbox" with "Test1234"


查看完整回答
反對 回復 2023-02-16
  • 1 回答
  • 0 關注
  • 110 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號