Cucumber 我可以在同一个功能文件中参数化两个场景的背景吗
我可以在两个不同的背景下运行相同的功能文件吗?我可以为两个场景参数化背景吗 以下是功能文件:Cucumber 我可以在同一个功能文件中参数化两个场景的背景吗,cucumber,Cucumber,我可以在两个不同的背景下运行相同的功能文件吗?我可以为两个场景参数化背景吗 以下是功能文件: @Smoke Feature: Login to the application Background: Given Launch "<Browser_type>" Browser Scenario: Logging into the application Given I open the application |Application_Name| |Kohls
@Smoke
Feature: Login to the application
Background:
Given Launch "<Browser_type>" Browser
Scenario: Logging into the application
Given I open the application
|Application_Name|
|Kohls |
|Gymboree |
Then I give username and password
|Username |Password|
|abc@yahoo.com|1234|
|def@yahoo.com|5678|
When I click submit button
Then I enter into my application page
Scenario: Logging into the application
Given I open the application
|Application_Name|
|Kohls |
|Gymboree |
Then I give username and password
|Username |Password|
|abc@yahoo.com|1234|
|def@yahoo.com|5678|
When I click submit button
Then I enter into my application page
Examples:
|Browser_type |
|Chrome |
|Firefox |
@烟雾
功能:登录到应用程序
背景:
给定启动“”浏览器
场景:登录到应用程序
假设我打开了申请表
|应用程序名称|
|科尔|
|金宝贝|
然后我给出用户名和密码
|用户名|密码|
|abc@yahoo.com|1234|
|def@yahoo.com|5678|
当我点击提交按钮时
然后我进入我的申请页面
场景:登录到应用程序
假设我打开了申请表
|应用程序名称|
|科尔|
|金宝贝|
然后我给出用户名和密码
|用户名|密码|
|abc@yahoo.com|1234|
|def@yahoo.com|5678|
当我点击提交按钮时
然后我进入我的申请页面
示例:
|浏览器类型|
|铬|
|火狐|
当我执行它时,我得到了一个错误
java.lang.RuntimeException:cucumber.runtime.CucumberException:分析功能文件Login.feature时出错
此使用场景的解决方案在功能中概述并删除背景 例如:
@Smoke Feature: Login to the application
Scenario Outline: Logging into the application
Given Launch "<Browser_type>" Browser
Given I open the application
|Application_Name|
|Kohls |
|Gymboree |
Then I give username and password
|Username |Password|
|abc@yahoo.com|1234|
|def@yahoo.com|5678|
When I click submit button
Then I enter into my application page
Examples:
|Browser_type |
|Chrome |
|Firefox |
Scenario Outline: Logging into the application
Given Launch "<Browser_type>" Browser
Given I open the application
|Application_Name|
|Kohls |
|Gymboree |
Then I give username and password
|Username |Password|
|abc@yahoo.com|1234|
|def@yahoo.com|5678|
When I click submit button
Then I enter into my application page
Examples:
|Browser_type |
|Chrome |
|Firefox |
@Smoke功能:登录到应用程序
场景大纲:登录到应用程序
给定启动“”浏览器
假设我打开了申请表
|应用程序名称
|科尔|
|金宝贝
然后我给出用户名和密码
|用户名|密码|
|abc@yahoo.com|1234|
|def@yahoo.com|5678|
当我点击提交按钮时
然后我进入我的申请页面
示例:
|浏览器类型
|铬|
|火狐|
场景大纲:登录到应用程序
给定启动“”浏览器
假设我打开了申请表
|应用程序名称
|科尔斯|
|金宝贝
然后我给出用户名和密码
|用户名|密码|
|abc@yahoo.com|1234|
|def@yahoo.com|5678|
当我点击提交按钮时
然后我进入我的申请页面
示例:
|浏览器类型
|铬|
|火狐|
希望这对您有所帮助…您是否能够解决此问题?这会使文件变得更加零碎,因为您现在有多个完全相同的示例数组副本,如果需要进行更改,您必须更新这些副本